To all our customers Regarding the change of names mentioned in the document, such as Mitsubishi Electric and Mitsubishi XX, to Renesas Technology Corp. The semiconductor operations of Hitachi and Mitsubishi Electric were transferred to Renesas Technology Corporation on April 1st 2003. These operations include microcomputer, logic, analog and discrete devices, and memory chips other than DRAMs (flash memory, SRAMs etc.) Accordingly, although Mitsubishi Electric, Mitsubishi Electric Corporation, Mitsubishi Semiconductors, and other Mitsubishi brand names are mentioned in the document, these names have in fact all been changed to Renesas Technology Corp. Thank you for your understanding. Except for our corporate trademark, logo and corporate statement, no changes whatsoever have been made to the contents of the document, and these changes do not constitute any alteration to the contents of the document itself. Note : Mitsubishi Electric will continue the business operations of high frequency & optical devices and power devices. Renesas Technology Corp. Customer Support Dept. April 1, 2003 MITSUBISHI 8-BIT SINGLE-CHIP MICROCOMPUTER 740 FAMILY / 38000 SERIES 38C3 Group User's Manual keep safety first in your circuit designs ! q Mitsubishi Electric Corporation puts the maximum effort into making semiconductor products better and more reliable, but there is always the possibility that trouble may occur with them. Trouble with semiconductors may lead to personal injury, fire or property damage. Remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of substitutive, auxiliary circuits, (ii) use of non-flammable material or (iii) prevention against any malfunction or mishap. Notes regarding these materials q These materials are intended as a reference to assist our customers in the selection of the Mitsubishi semiconductor product best suited to the customer's application; they do not convey any license under any intellectual property rights, or any other rights, belonging to Mitsubishi Electric Corporation or a third party. q Mitsubishi Electric Corporation assumes no responsibility for any damage, or infringement of any third-party's rights, originating in the use of any product data, diagrams, charts or circuit application examples contained in these materials. q All information contained in these materials, including product data, diagrams and charts, represent information on products at the time of publication of these materials, and are subject to change by Mitsubishi Electric Corporation without notice due to product improvements or other reasons. It is therefore recommended that customers contact Mitsubishi Electric Corporation or an authorized Mitsubishi Semiconductor product distributor for the latest product information before purchasing a product listed herein. q Mitsubishi Electric Corporation semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. Please contact Mitsubishi Electric Corporation or an authorized Mitsubishi Semiconductor product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. q The prior written approval of Mitsubishi Electric Corporation is necessary to reprint or reproduce in whole or in part these materials. q If these products or technologies are subject to the Japanese export control restrictions, they must be exported under a license from the Japanese government and cannot be imported into a country other than the approved destination. Any diversion or reexport contrary to the export control laws and regulations of JAPAN and/or the country of destination is prohibited. q Please contact Mitsubishi Electric Corporation or an authorized Mitsubishi Semiconductor product distributor for further details on these materials or the products contained therein. REVISION DESCRIPTION LIST Rev. No. 1.0 First Edition Revision Description 38C3 Group User's Manual Rev. date 990412 (1/1) Preface This user's manual describes Mitsubishi's CMOS 8bit microcomputers 38C3 Group. After reading this manual, the user should have a through knowledge of the functions and features of the 38C3 Group, and should be able to fully utilize the product. The manual starts with specifications and ends with application examples. For details of software, refer to the "740 Family Software Manual." For details of development support tools, refer to the "DEVELOPMENT SUPPORT TOOLS FOR MICROCOMPUTERS" data book. BEFORE USING THIS USER'S MANUAL This user's manual consists of the following three chapters. Refer to the chapter appropriate to your conditions, such as hardware design or software development. 1. Organization q CHAPTER 1 HARDWARE This chapter describes features of the microcomputer and operation of each peripheral function. q CHAPTER 2 APPLICATION This chapter describes usage and application examples of peripheral functions, based mainly on setting examples of relevant registers. q CHAPTER 3 APPENDIX This chapter includes a list of registers, and necessary information for systems development using the microcomputer, the mask ROM confirmation (for mask ROM version), ROM programming confirmation, and the mark specifications which are to be submitted when ordering. 2. Structure of Register The figure of each register structure describes its functions, contents at reset, and attributes as follows: (Note 2) Bits b7 b6 b5 b4 b3 b2 b1 b0 0 Bit attributes (Note 1) Contents immediately after reset release CPU mode register (CPUM) [Address : 3B 16] b 0 1 2 3 4 5 6 7 Stack page selection bit Name Processor mode bits b1 b0 Functions 0 0 : Single-chip mode 01: Not available 10: 11: 0 : 0 page 1 : 1 page At reset RW 0 0 0 0 0 0 ! ! Nothing arranged for these bits. These are write disabled bits. When these bits are read out, the contents are "0." Fix this bit to "0." Main clock division ratio selection bits 0 0 : = XIN/2 (High-speed mode) 0 1 : = XIN/8 (Middle-speed mode) 1 0 : = XIN/8 (Middle-speed mode) 1 1 : = XIN (Double-speed mode) b7 b6 1 0 : Bit in which nothing is arranged : Bit that is not used for control of the corresponding function Notes 1: Contents immediately after reset release 0******"0" at reset release 1******"1" at reset release Undefined******Undefined or reset release T ******Contents determined by option at reset release 2: Bit attributes******The attributes of control register bits are classified into 3 bytes : read-only, write-only and read and write. In the figure, these attributes are represented as follows : R******Read ******Read enabled !******Read disabled W******Write ******Write enabled ! ******Write disabled Table of contents Table of contents CHAPTER 1 HARDWARE DESCRIPTION ................................................................................................................................ 1-2 FEATURES .................................................................................................................................... 1-2 APPLICATION ................................................................................................................................ 1-2 PIN CONFIGURATION .................................................................................................................. 1-2 FUNCTIONAL BLOCK .................................................................................................................. 1-3 PIN DESCRIPTION ........................................................................................................................ 1-4 PART NUMBERING ....................................................................................................................... 1-6 GROUP EXPANSION .................................................................................................................... 1-7 Memory Type ............................................................................................................................ 1-7 Memory Size ............................................................................................................................. 1-7 Package ..................................................................................................................................... 1-7 FUNCTIONAL DESCRIPTION ...................................................................................................... 1-8 Central Processing Unit (CPU) .............................................................................................. 1-8 Memory .................................................................................................................................... 1-12 I/O Ports .................................................................................................................................. 1-14 Interrupts ................................................................................................................................. 1-19 Timers ...................................................................................................................................... 1-23 Serial I/O ................................................................................................................................. 1-28 A-D Converter ......................................................................................................................... 1-30 LCD Drive control circuit ....................................................................................................... 1-31 Clock Output Function ....................................................................................................... 1-37 ROM Correction Function (Mask ROM version only) ........................................................ 1-38 Reset Circuit ........................................................................................................................... 1-39 Clock Generating Circuit ....................................................................................................... 1-41 NOTES ON PROGRAMMING ..................................................................................................... 1-44 NOTES ON USE .......................................................................................................................... 1-44 DATA REQUIRED FOR MASK ORDERS ................................................................................ 1-45 DATA REQUIRED FOR ROM WRITING ORDERS ................................................................. 1-45 ROM PROGRAMMING METHOD .............................................................................................. 1-45 FUNCTIONAL DESCRIPTION SUPPLEMENT ......................................................................... 1-46 CHAPTER 2 APPLICATION 2.1 I/O port ..................................................................................................................................... 2-2 2.1.1 Memory map ................................................................................................................... 2-2 2.1.2 Relevant registers .......................................................................................................... 2-3 2.1.3 Terminate unused pins .................................................................................................. 2-7 2.1.4 Notes on I/O port ........................................................................................................... 2-8 2.1.5 Termination of unused pins .......................................................................................... 2-9 2.2 Timer ....................................................................................................................................... 2-10 2.2.1 Memory map ................................................................................................................. 2-10 2.2.2 Relevant registers ........................................................................................................ 2-11 2.2.3 Timer application examples ........................................................................................ 2-19 2.2.4 Notes on timer A (PWM mode and IGBT output mode) ...................................... 2-31 2.3 Serial I/O ................................................................................................................................ 2-33 2.3.1 Memory map ................................................................................................................. 2-33 2.3.2 Relevant registers ........................................................................................................ 2-33 2.3.3 Serial I/O connection examples ................................................................................. 2-36 38C3 Group User's Manual 1 Table of contents 2.3.4 Serial I/O's modes ....................................................................................................... 2-38 2.3.5 Serial I/O application examples ................................................................................. 2-38 2.3.6 Notes on serial I/O ...................................................................................................... 2-51 2.4 LCD controller ...................................................................................................................... 2-52 2.4.1 Memory map ................................................................................................................. 2-52 2.4.2 Relevant registers ........................................................................................................ 2-53 2.4.3 LCD controller application examples ......................................................................... 2-54 2.4.4 Notes on LCD controller ............................................................................................. 2-58 2.5 A-D converter ....................................................................................................................... 2-59 2.5.1 Memory map ................................................................................................................. 2-59 2.5.2 Relevant registers ........................................................................................................ 2-59 2.5.3 A-D converter application examples .......................................................................... 2-62 2.5.4 Notes on A-D converter .............................................................................................. 2-64 2.6 ROM correct function ......................................................................................................... 2-65 2.6.1 Memory map ................................................................................................................. 2-65 2.6.2 Relevant registers ........................................................................................................ 2-66 2.6.3 ROM correct function application examples ............................................................. 2-67 2.7 Reset circuit ......................................................................................................................... 2-69 2.7.1 Connection example of reset IC ................................................................................ 2-69 2.7.2 Notes on reset circuit .................................................................................................. 2-70 2.8 Clock generating circuit .................................................................................................... 2-71 2.8.1 Relevant register .......................................................................................................... 2-71 2.8.2 Clock generating circuit application examples ......................................................... 2-72 CHAPTER 3 APPENDIX 3.1 Electrical characteristics ..................................................................................................... 3-2 3.1.1 Absolute maximum ratings ............................................................................................ 3-2 3.1.2 Recommended operating conditions ............................................................................ 3-2 3.1.3 Electrical characteristics ................................................................................................ 3-5 3.1.4 A-D converter characteristics ....................................................................................... 3-7 3.1.5 Timing requirements and switching characteristics ................................................... 3-8 3.1.6 Absolute maximum ratings (M version)..................................................................... 3-10 3.1.7 Recommended operating conditions (M version)..................................................... 3-10 3.1.8 Electrical characteristics (M version) ......................................................................... 3-14 3.1.9 A-D converter characteristics (M version) ................................................................ 3-16 3.1.10 Timing requirements and switching characteristics (M version) .......................... 3-17 3.2 Standard characteristics .................................................................................................... 3-20 3.2.1 Power source current standard characteristics ........................................................ 3-20 3.2.2 Port standard characteristics ...................................................................................... 3-21 3.3 Notes on use ........................................................................................................................ 3-26 3.3.1 Notes on interrupts ...................................................................................................... 3-26 3.3.2 Notes on timer A (PWM mode and IGBT output mode) ...................................... 3-27 3.3.3 Notes on serial I/O ...................................................................................................... 3-29 3.3.4 Notes on LCD controller ............................................................................................. 3-29 3.3.5 Notes on A-D converter .............................................................................................. 3-30 3.3.6 Notes on reset circuit .................................................................................................. 3-30 3.4 Countermeasures against noise ...................................................................................... 3-31 3.4.1 Shortest wiring length .................................................................................................. 3-31 3.4.2 Connection of bypass capacitor across VSS line and VCC line ............................... 3-33 3.4.3 Wiring to analog input pins ........................................................................................ 3-34 3.4.4 Oscillator concerns ....................................................................................................... 3-34 3.4.5 Setup for I/O ports ....................................................................................................... 3-36 2 38C3 Group User's Manual Table of contents 3.4.6 Providing of watchdog timer function by software .................................................. 3-37 3.5 Control registers .................................................................................................................. 3-38 3.6 Mask ROM confirmation form........................................................................................... 3-58 3.7 ROM programming confirmation form ............................................................................ 3-62 3.8 Mark specification form ..................................................................................................... 3-66 3.9 Package outline ................................................................................................................... 3-67 3.10 Machine instructions ........................................................................................................ 3-68 3.11 List of instruction code ................................................................................................... 3-79 3.12 SFR memory map .............................................................................................................. 3-80 3.13 Pin configuration ............................................................................................................... 3-81 38C3 Group User's Manual 3 List of figures List of figures CHAPTER 1 HARDWARE Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. 1 M38C34M6AXXXFP pin configuration .............................................................................. 1-2 2 Functional block diagram ................................................................................................... 1-3 3 Part numbering .................................................................................................................... 1-6 4 Memory expansion plan ..................................................................................................... 1-7 5 740 Family CPU register structure ................................................................................... 1-8 6 Register push and pop at interrupt generation and subroutine call ........................... 1-9 7 Structure of CPU mode register ..................................................................................... 1-11 8 Memory map diagram ...................................................................................................... 1-12 9 Memory map of special function register (SFR) .......................................................... 1-13 10 Structure of PULL register A and PULL register B ................................................... 1-14 11 Structure of port P8 output selection register ............................................................ 1-14 12 Port block diagram (1) ................................................................................................... 1-16 13 Port block diagram (2) ................................................................................................... 1-17 14 Port block diagram (3) ................................................................................................... 1-18 15 Interrupt control ............................................................................................................... 1-21 16 Structure of interrupt-related registers ......................................................................... 1-21 17 Connection example when using key input interrupt and port P8 block diagram 1-22 18 Structure of timer related register ................................................................................ 1-23 19 Block diagram of timer .................................................................................................. 1-24 20 Timing chart of timer 6 PWM1 mode ........................................................................... 1-25 21 Block diagram of timer A .............................................................................................. 1-26 22 Structure of timer A related registers .......................................................................... 1-26 23 Timing chart of timer A PWM, IGBT output modes .................................................. 1-27 24 Block diagram of serial I/O ........................................................................................... 1-28 25 Structure of serial I/O control register ......................................................................... 1-29 26 Serial I/O timing (for LSB first) .................................................................................... 1-29 27 Structure of A-D control register .................................................................................. 1-30 28 Black diagram of A-D converter ................................................................................... 1-30 29 Structure of LCD related registers ............................................................................... 1-31 30 Block diagram of LCD controller/driver ....................................................................... 1-32 31 Example of circuit at each bias.................................................................................... 1-33 32 LCD display RAM map .................................................................................................. 1-34 33 LCD drive waveform (1/2 bias) .................................................................................... 1-35 34 LCD drive waveform (1/3 bias) .................................................................................... 1-36 35 Structure of output control register .......................................................................... 1-37 36 Structure of ROM correct address register ................................................................. 1-38 37 Structure of ROM correct data .................................................................................... 1-38 38 Structure of ROM correct enable register 1 ............................................................... 1-38 39 Reset circuit example .................................................................................................... 1-39 40 Reset sequence .............................................................................................................. 1-39 41 Internal status at reset .................................................................................................. 1-40 42 Ceramic resonator circuit .............................................................................................. 1-41 43 External clock input circuit ............................................................................................ 1-41 44 Clock generating circuit block diagram ....................................................................... 1-42 45 State transitions of system clock ................................................................................. 1-43 46 Programming and testing of One Time PROM version ............................................ 1-45 47 Timing chart after interrupt occurs ............................................................................... 1-47 4 38C3 Group User's Manual List of figures Fig. 48 Time up to execution of interrupt processing routine ............................................... 1-47 Fig. 49 A-D conversion equivalent circuit ................................................................................. 1-49 Fig. 50 A-D conversion timing chart .......................................................................................... 1-49 CHAPTER 2 APPLICATION Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. 2.1.1 Memory map of I/O port relevant registers .............................................................. 2-2 2.1.2 Structure of port Pi (i = 0, 1, 2, 3, 4, 5, 6, 8) ........................................................ 2-3 2.1.3 Structure of port P7 ..................................................................................................... 2-3 2.1.4 Structure of Port P0 direction register and port P1 direction register ................. 2-4 2.1.5 Structure of Port Pi direction register (i = 2, 4, 5, 6, 8) ....................................... 2-4 2.1.6 Structure of Port P7 direction register ...................................................................... 2-5 2.1.7 Structure of PULL register A ...................................................................................... 2-5 2.1.8 Structure of PULL register B ...................................................................................... 2-6 2.1.9 Structure of Port P8 output selection register ......................................................... 2-6 2.2.1 Memory map of registers relevant to timers .......................................................... 2-10 2.2.2 Structure of Timer i (i=1, 3, 4, 5, 6) ....................................................................... 2-11 2.2.3 Structure of Timer 2 .................................................................................................. 2-11 2.2.4 Structure of Timer 6 PWM register ......................................................................... 2-12 2.2.5 Structure of Timer 12 mode register ....................................................................... 2-12 2.2.6 Structure of Timer 34 mode register ....................................................................... 2-13 2.2.7 Structure of Timer 56 mode register ....................................................................... 2-13 2.2.8 Structure of Timer A register (low-order, high-order) ........................................... 2-14 2.2.9 Structure of Compare register (low-order, high-order) .......................................... 2-14 2.2.10 Structure of Timer A mode register ...................................................................... 2-15 2.2.11 Structure of Timer A control register .................................................................... 2-15 2.2.12 Structure of Interrupt request register 1 ............................................................... 2-16 2.2.13 Structure of Interrupt request register 2 ............................................................... 2-17 2.2.14 Structure of Interrupt control register 1 ................................................................ 2-18 2.2.15 Structure of Interrupt control register 2 ................................................................ 2-18 2.2.16 Timers connection and setting of division ratios ................................................. 2-20 2.2.17 Relevant registers setting ....................................................................................... 2-21 2.2.18 Control procedure ..................................................................................................... 2-22 2.2.19 Peripheral circuit example ....................................................................................... 2-23 2.2.20 Timers connection and setting of division ratios ................................................. 2-23 2.2.21 Relevant registers setting ....................................................................................... 2-24 2.2.22 Control procedure ..................................................................................................... 2-24 2.2.23 Judgment method of valid/invalid of input pulses ............................................... 2-25 2.2.24 Relevant registers setting ....................................................................................... 2-26 2.2.25 Control procedure ..................................................................................................... 2-27 2.2.26 Timers connection and setting of division ratios ................................................. 2-28 2.2.27 Relevant registers setting ....................................................................................... 2-29 2.2.28 Control procedure ..................................................................................................... 2-30 2.2.29 PWM output and IGBT output (1) ......................................................................... 2-31 2.2.30 PWM output and IGBT output (2) ......................................................................... 2-31 2.2.31 PWM output and IGBT output (3) ......................................................................... 2-32 2.3.1 Memory map of registers relevant to Serial I/O .................................................... 2-33 2.3.2 Structure of Serial I/O control register 1 ................................................................ 2-33 2.3.3 Structure of Serial I/O control register 2 ................................................................ 2-34 2.3.4 Structure of Interrupt request register 1 ................................................................. 2-34 2.3.5 Structure of Interrupt control register 1 .................................................................. 2-35 2.3.6 Serial I/O connection examples (1) ......................................................................... 2-36 2.3.7 Serial I/O connection examples (2) ......................................................................... 2-37 38C3 Group User's Manual 5 List of figures Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. 2.3.8 Serial I/O's modes ..................................................................................................... 2-38 2.3.9 Connection diagram ................................................................................................... 2-38 2.3.10 Timing chart .............................................................................................................. 2-39 2.3.11 Registers setting relevant to transmission side ................................................... 2-40 2.3.12 Registers setting relevant to reception side ......................................................... 2-41 2.3.13 Control procedure of transmission side ................................................................ 2-41 2.3.14 Control procedure of reception side ...................................................................... 2-42 2.3.15 Connection diagram ................................................................................................. 2-43 2.3.16 Timing chart .............................................................................................................. 2-43 2.3.17 Relevant registers setting ....................................................................................... 2-44 2.3.18 Setting of transmission data ................................................................................... 2-44 2.3.19 Control procedure ..................................................................................................... 2-45 2.3.20 Connection diagram ................................................................................................. 2-46 2.3.21 Timing chart .............................................................................................................. 2-47 2.3.22 Relevant registers setting in master unit .............................................................. 2-48 2.3.23 Relevant registers setting in slave unit ................................................................ 2-48 2.3.24 Control procedure of master unit ........................................................................... 2-49 2.3.25 Control procedure of slave unit ............................................................................. 2-50 2.4.1 Memory map of registers relevant to LCD controller............................................ 2-52 2.4.2 Structure of Segment output enable register ......................................................... 2-53 2.4.3 Structure of LCD mode register ............................................................................... 2-53 2.4.4 LCD panel ................................................................................................................... 2-54 2.4.5 Segment allocation example ..................................................................................... 2-54 2.4.6 LCD display RAM map .............................................................................................. 2-55 2.4.7 LCD display RAM setting .......................................................................................... 2-55 2.4.8 Relevant registers setting ......................................................................................... 2-56 2.4.9 Control procedure ....................................................................................................... 2-57 2.5.1 Memory map of A-D converter relevant registers ................................................. 2-59 2.5.2 Structure of A-D control register .............................................................................. 2-59 2.5.3 Structure of A-D conversion register (low-order) ................................................... 2-60 2.5.4 Structure of A-D conversion register (high-order) ................................................. 2-60 2.5.5 Structure of Interrupt request register 2 ................................................................. 2-61 2.5.6 Structure of Interrupt control register 2 .................................................................. 2-61 2.5.7 Connection diagram ................................................................................................... 2-62 2.5.8 Setting of relevant registers ..................................................................................... 2-62 2.5.9 Control procedure ....................................................................................................... 2-63 2.6.1 Memory map of ROM correct function relevant registers .................................... 2-65 2.6.2 Structure of ROM correct enable register 1 ........................................................... 2-66 2.6.3 Connection diagram ................................................................................................... 2-67 2.6.4 Setting of relevant registers ..................................................................................... 2-67 2.6.5 Control procedure ....................................................................................................... 2-68 2.7.1 Example of power-on reset circuit ........................................................................... 2-69 2.7.2 RAM backup system example .................................................................................. 2-69 2.8.1 Structure of CPU mode register .............................................................................. 2-71 2.8.2 Connection diagram ................................................................................................... 2-72 2.8.3 Status transition diagram during power failure ...................................................... 2-73 2.8.4 Setting of relevant registers ..................................................................................... 2-74 2.8.5 Control procedure ....................................................................................................... 2-75 2.8.6 Structure of clock counter ......................................................................................... 2-76 2.8.7 Initial setting of relevant registers ........................................................................... 2-77 2.8.8 Setting of relevant registers after detecting power failure ................................... 2-78 2.8.9 Control procedure ....................................................................................................... 2-79 6 38C3 Group User's Manual List of figures CHAPTER 3 APPENDIX 3.1.1 Circuit for measuring output switching characteristics .......................................... 3-18 3.1.2 Timing chart ................................................................................................................ 3-19 3.2.1 Power source current standard characteristics ...................................................... 3-20 3.2.2 Power source current standard characteristics (in wait mode) ........................... 3-20 3.2.3 CMOS output port (P0, P1, P2, P3) P-channel side characteristics (25 C) .... 3-21 3.2.4 CMOS output port (P0, P1, P2, P3) P-channel side characteristics (90 C) .... 3-21 3.2.5 CMOS output port (P0, P1, P2, P3) P-channel side characteristics (25 C) .... 3-22 3.2.6 CMOS output port (P0, P1, P2, P3) N-channel side characteristics (90 C) ... 3-22 3.2.7 CMOS output port (P4, P50, P52-P57, P6, P70, P71, P8) P-channel side characteristics (25 C) .......................................................................................................................... 3-23 Fig. 3.2.8 CMOS output port (P4, P50, P52-P57, P6, P70, P71, P8) P-channel side characteristics (90 C) .......................................................................................................................... 3-23 Fig. 3.2.9 CMOS output port (P4, P52-P57, P6, P70, P71) N-channel side characteristics (25 C) ........................................................................................................................................................ 3-24 Fig. 3.2.10 CMOS output port (P4, P52-P57, P6, P70, P71) N-channel side characteristics (90 C) ....................................................................................................................... 3-24 Fig. 3.2.11 CMOS output port (P50, P8) N-channel side characteristics (25 C) ............... 3-25 Fig. 3.2.12 CMOS output port (P50, P8) N-channel side characteristics (90 C) ............... 3-25 Fig. 3.3.1 Sequence of switch detection edge......................................................................... 3-26 Fig. 3.3.2 Sequence of check of interrupt request bit ............................................................ 3-26 Fig. 3.3.3 Structure of interrupt control register 2 .................................................................. 3-27 Fig. 3.3.4 PWM output and IGBT output (1) ............................................................................ 3-27 Fig. 3.3.5 PWM output and IGBT output (2) ............................................................................ 3-28 Fig. 3.3.6 PWM output and IGBT output (3) ............................................................................ 3-28 Fig. 3.4.1 Selection of packages ............................................................................................... 3-31 Fig. 3.4.2 Wiring for the RESET pin ......................................................................................... 3-31 Fig. 3.4.3 Wiring for clock I/O pins ........................................................................................... 3-32 Fig. 3.4.4 Wiring for the VPP pin of the One Time PROM and the EPROM version ......... 3-33 Fig. 3.4.5 Bypass capacitor across the VSS line and the VCC line ........................................ 3-33 Fig. 3.4.6 Analog signal line and a resistor and a capacitor ................................................ 3-34 Fig. 3.4.7 Wiring for a large current signal line ...................................................................... 3-34 Fig. 3.4.8 Wiring of signal lines where potential levels change frequently ......................... 3-35 Fig. 3.4.9 VSS pattern on the underside of an oscillator ........................................................ 3-35 Fig. 3.4.10 Setup for I/O ports ................................................................................................... 3-36 Fig. 3.4.11 Watchdog timer by software ................................................................................... 3-37 Fig. 3.5.1 Structure of Port Pi .................................................................................................... 3-38 Fig. 3.5.2 Structure of Port P0 direction register and Port P1 direction register ............... 3-38 Fig. 3.5.3 Structure of Port Pi direction register ..................................................................... 3-39 Fig. 3.5.4 Structure of Port P7 ................................................................................................... 3-39 Fig. 3.5.5 Structure of Port P7 direction register .................................................................... 3-40 Fig. 3.5.6 Structure of PULL register A .................................................................................... 3-40 Fig. 3.5.7 Structure of PULL register B .................................................................................... 3-41 Fig. 3.5.8 Structure of Port P8 output selection register ....................................................... 3-42 Fig. 3.5.9 Structure of Serial I/O control register 1 ................................................................ 3-43 Fig. 3.5.10 Structure of Serial I/O control register 2 .............................................................. 3-44 Fig. 3.5.11 Structure of Serial I/O register ............................................................................... 3-44 Fig. 3.5.12 Structure of Timer i ................................................................................................. 3-45 Fig. 3.5.13 Structure of Timer 2 ................................................................................................ 3-45 Fig. 3.5.14 Structure of Timer 6 PWM register ....................................................................... 3-46 Fig. 3.5.15 Structure of Timer 12 mode register ..................................................................... 3-46 Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. 38C3 Group User's Manual 7 List of figures Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. Fig. 3.5.16 3.5.17 3.5.18 3.5.19 3.5.20 3.5.21 3.5.22 3.5.23 3.5.24 3.5.25 3.5.26 3.5.27 3.5.28 3.5.29 3.5.30 3.5.31 3.5.32 3.5.33 3.5.34 Structure Structure Structure Structure Structure Structure Structure Structure Structure Structure Structure Structure Structure Structure Structure Structure Structure Structure Structure of of of of of of of of of of of of of of of of of of of Timer 34 mode register ..................................................................... 3-47 Timer 56 mode register ..................................................................... 3-47 output control register .................................................................... 3-48 Timer A register (low-order, high-order) ......................................... 3-48 Compare register (low-order, high-order) ........................................ 3-49 Timer A mode register ...................................................................... 3-49 Timer A control register .................................................................... 3-50 A-D control register ............................................................................ 3-50 A-D conversion register (low-order) ................................................. 3-51 A-D conversion register (high-order) ............................................... 3-51 Segment output enable register ....................................................... 3-52 LCD mode register ............................................................................. 3-52 Interrupt edge selection register ...................................................... 3-53 CPU mode register ............................................................................ 3-53 Interrupt reqeust register 1 ............................................................... 3-54 Interrupt request register 2 ............................................................... 3-55 Interrupt control register 1 ................................................................ 3-56 Interrupt control register 2 ................................................................ 3-56 ROM correct enable register 1 ......................................................... 3-57 8 38C3 Group User's Manual List of tables List of tables CHAPTER 1 HARDWARE Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table 1 Pin description (1) ........................................................................................................... 1-4 2 Pin description (2) ........................................................................................................... 1-5 3 Support products ............................................................................................................. 1-7 4 Push and pop instructions of accumulator or processor status register ................. 1-9 5 Set and clear instructions of each bit of processor status register ....................... 1-10 6 List of I/O port function (1) .......................................................................................... 1-14 7 List of I/O port function (2) .......................................................................................... 1-15 8 Interrupt vector addresses and priority ...................................................................... 1-20 9 Function of P46/SCLK1 and P40/SCLK2 ..................................................................................................................................... 1-28 10 Maximum number of display pixels at each duty ratio .......................................... 1-31 11 Bias control and applied voltage to Vl1-VL3 .......................................................................................................... 1-33 12 Duty ratio control and common pins used ............................................................... 1-33 13 Programming adapter .................................................................................................. 1-45 14 Interrupt sources, vector addresses and interrupt priority ..................................... 1-46 15 Relative formula for a reference voltage VREF of A-D converter and Vref ..................... 1-48 16 Change of A-D conversion register during A-D conversion .................................. 1-48 CHAPTER 2 APPLICATION Table 2.1.1 Termination of unused pins ..................................................................................... 2-7 CHAPTER 3 APPENDIX Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table 3.1.1 Absolute maximum ratings ....................................................................................... 3-2 3.1.2 Recommended operating conditions ....................................................................... 3-2 3.1.3 Recommended operating conditions ....................................................................... 3-3 3.1.4 Recommended operating conditions ....................................................................... 3-4 3.1.5 Electrical characteristics ........................................................................................... 3-5 3.1.6 Electrical characteristics ........................................................................................... 3-6 3.1.7 A-D converter characteristics .................................................................................. 3-7 3.1.8 Timing requirements 1 .............................................................................................. 3-8 3.1.9 Timing requirements 2 .............................................................................................. 3-8 3.1.10 Switching characteristics 1 .................................................................................... 3-9 3.1.11 Switching characteristics 2 .................................................................................... 3-9 3.1.12 Absolute maximum ratings (M version) ............................................................. 3-10 3.1.13 Recommended operating conditions (M version) ............................................. 3-10 3.1.14 Recommended operating conditions (M version) ............................................. 3-11 3.1.15 Recommended operating conditions (M version) ............................................. 3-11 3.1.16 Recommended operating conditions (M version) ............................................. 3-12 3.1.17 Recommended operating conditions (M version) ............................................. 3-13 3.1.18 Electrical characteristics (M version).................................................................. 3-14 3.1.19 Electrical characteristics (M version).................................................................. 3-15 3.1.20 A-D converter characteristics (M version) ......................................................... 3-16 3.1.21 Timing requirements 1 (M version) .................................................................... 3-17 3.1.22 Timing requirements 2 (M version) .................................................................... 3-17 3.1.23 Switching characteristics 1 (M version) ............................................................. 3-18 3.1.24 Switching characteristics 2 (M version) ............................................................. 3-18 38C3 Group User's Manual 9 CHAPTER 1 HARDWARE DESCRIPTION FEATURES APPLICATION PIN CONFIGURATION FUNCTIONAL BLOCK PIN DESCRIPTION PART NUMBERING GROUP EXPANSION FUNCTIONAL DESCRIPTION NOTES ON PROGRAMMING NOTES ON USE DATA REQUIRED FOR MASK ORDERS DATA REQUIRED FOR ROM WRITING ORDERS ROM PROGRAMMING METHOD FUNCTIONAL DESCRIPTION SUPPLEMENT HARDWARE DESCRIPTION/FEATURES/APPLICATION/PIN CONFIGURATION DESCRIPTION The 38C3 group is the 8-bit microcomputer based on the 740 family core technology. The 38C3 group has a LCD drive control circuit, a 10-channel A-D converter, and a Serial I/O as additional functions. The various microcomputers in the 38C3 group include variations of internal memory size and packaging. For details, refer to the section on part numbering. For details on availability of microcomputers in the 38C3 group, refer to the section on group expansion. qLCD drive control circuit Bias ............................................................................ 1/1, 1/2, 1/3 Duty .................................................................... 1/1, 1/2, 1/3, 1/4 Common output .......................................................................... 4 Segment output ........................................................................ 32 q2 Clock generating circuit (connect to external ceramic resonator or quartz-crystal oscillator) qPower source voltage In high-speed mode .................................................... 4.0 to 5.5 V In middle-speed mode ................................................ 2.5 to 5.5 V (M version is 2.2V to 5.5 V) In low-speed mode ..................................................... 2.5 to 5.5 V (M version is 2.2V to 5.5 V) qPower dissipation In high-speed mode ........................................................... 32 mW (at 8 MHz oscillation frequency) In low-speed mode .............................................................. 45 W (at 32 kHz oscillation frequency, at 3 V power source voltage) qOperating temperature range ................................... - 20 to 85C V Mask ROM version only FEATURES qBasic machine-language instructions ....................................... 71 qThe minimum instruction execution time ............................. 0.5 s (at 8MHz oscillation frequency) qMemory size ROM .................................................................. 4 K to 48 K bytes RAM ................................................................. 192 to 1024 bytes qProgrammable input/output ports ............................................. 57 qSoftware pull-up/pull-down resistors ..................................................... (Ports P0-P8 except Port P51) qInterrupts ................................................... 16 sources, 16 vectors (includes key input interrupt) qTimers ............................................................ 8-bit ! 6, 16-bit ! 1 qA-D converter ................................................. 10-bit ! 8 channels qSerial I/O ....................................... 8-bit ! 1 (Clock-synchronized) APPLICATION Camera, household appliances, consumer electronics, etc. PIN CONFIGURATION (TOP VIEW) P20/SEG0 P21/SEG1 P22/SEG2 P23/SEG3 P24/SEG4 P25/SEG5 P26/SEG6 P27/SEG7 P00/SEG8 P01/SEG9 P02/SEG10 P03/SEG11 P04/SEG12 P05/SEG13 P06/SEG14 P07/SEG15 P10/SEG16 P11/SEG17 P12/SEG18 P13/SEG19 P14/SEG20 P15/SEG21 P16/SEG22 P17/SEG23 54 50 45 62 53 49 44 64 63 61 56 52 43 58 60 55 51 48 42 59 57 P47/SRDY P46/SCLK1 P45/SOUT P44/SIN P43/ P42/T3OUT P41/T1OUT P40/SCLK2 AVSS VREF P67/AN7 P66/AN6 P65/AN5 P64/AN4 P63/AN3 P62/AN2 47 46 41 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 12 16 22 13 18 19 21 10 11 14 15 17 20 23 24 4 2 1 3 8 5 6 7 9 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 M38C34M6AXXXFP P30/SEG24 P31/SEG25 P32/SEG26 P33/SEG27 P34/SEG28 P35/SEG29 P36/SEG30 P37/SEG31 COM0 COM1 COM2 COM3 VL1 VL2 VL3 P80 Fig. 1 M38C34M6AXXXFP pin configuration 1-2 P61/AN1 P60/AN0 P57/INT2 P56/INT1 P55/INT0 P54/CNTR1 P53/CNTR0 P52/PWM1 P51 RESET P71/XcOUT P70/XcIN VSS XIN XOUT VCC P50/TAOUT P87 P86 P85 P84 P83 P82 P81 Package type : 80P6N-A 80-pin plastic-molded QFP 38C3 Group User's Manual FUNCTIONAL BLOCK DIAGRAM Main clock input XIN Reset input RESET (5V) VCC (0V) VSS Main clock output XOUT I/O port P8 18 19 20 21 22 23 24 25 14 15 13 10 16 ROM corrective circuit RAM ROM corrective RAM (8 bytes) LCD display RAM (16 bytes) Key-on wake-up Fig. 2 Functional block diagram Data bus P8(8) V CPU A ROM X Y S PCL Timer 1(8) Timer 3(8) Timer 5(8) Timer A(16) Timer 6(8) Timer 4(8) Timer 2(8) PS LCD drive control circuit Clock generating circuit 28 27 26 32 VL1 VL2 VL3 31 XCIN Subclock input XCOUT Subclock output 30 COM0 COM1 COM2 29 COM3 INT0-INT2 12 11 1 2 75 76 77 78 79 80 74 73 3 4 5 6 7 8 9 17 65 66 67 68 69 70 71 72 T1OUT, T3OUT 38C3 Group User's Manual SI/O(8) CNTR0,CNTR1 PWM0,PWM1 P4(8) P5(8) P3(8) P2(8) 33 34 35 36 37 38 39 40 57 58 59 60 61 62 63 64 PCH A-D converter(10) XCOUT XCIN P7(2) P6(8) P1(8) P0(8) 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 I/O port P7 (0V) I/O port P6 I/O port P5 VREF AVSS I/O port P4 Output port P3 I/O port P2 I/O port P1 I/O port P0 FUNCTIONAL BLOCK HARDWARE V This is valid only in mask ROM version. 1-3 HARDWARE PIN DESCRIPTION PIN DESCRIPTION Table 1 Pin description (1) Pin VCC, VSS VREF AVSS RESET XIN XOUT VL1 - VL3 COM0 - COM3 Name Power source Analog reference voltage Analog power source Reset input Clock input Clock output LCD power source Common output Function * Apply voltage of 2.5V V to 5.5 V to VCC, and 0 V to VSS. * Reference voltage input pin for A-D converter. GND input pin for A-D converter. Connect to VSS. Reset input pin for active "L." Input and output pins for the main clock generating circuit. Feedback resistor is built in between XIN pin and XOUT pin. Connect a ceramic resonator or a quartz-crystal oscillator between the XIN and XOUT pins to set the oscillation frequency. * If an external clock is used, connect the clock source to the XIN pin and leave the XOUT pin open. * Input 0 VL1 VL2 VL3 VCC voltage. * Input 0 - VL3 voltage to LCD. * LCD common output pins. * COM1, COM2, and COM3 are not used at 1/1 duty ratio. * COM2 and COM3 are not used at 1/2 duty ratio. * COM3 is not used at 1/3 duty ratio. * 8-bit I/O port. * LCD segment pins * CMOS compatible input level. * CMOS 3-state output structure. * I/O direction register allows each port to be individually programmed as either input or output. * Pull-down control is enabled. * * * * * * Function except a port function P00/SEG8 - P07/SEG15 I/O port P0 P10/SEG16 - I/O port P1 P17/SEG23 P20/SEG0 - P27/SEG7 I/O port P2 P30/SEG24 - Output port P3 P37/SEG31 P40/SCLK2 P41/T1OUT P42/T3OUT P43/ P44/SIN, P45/SOUT, P46/SCLK1, P47/SRDY I/O port P4 * 8-bit output port. * CMOS state output. * Pull-down control is enabled. * 8-bit I/O port. * CMOS compatible input level. * CMOS 3-state output structure. * I/O direction register allows each pin to be individually programmed as either input or output. * Pull-up control is enabled. * Serial I/O function pin * Timer output pin * Timer output pin * output pin * Serial I/O function pins V Mask ROM version of M version is 2.2 V to 5.5 V. 1-4 38C3 Group User's Manual HARDWARE PIN DESCRIPTION Table 2 Pin description (2) Pin P51 P50/TAOUT P52/PWM1 P53/CNTR0, P54/CNTR1 P55/INT0, P56/INT1, P57/INT2 P60/AN0 - P67/AN7 Name Input port P5 I/O port P5 * * * * * * Function 1-bit input pin. CMOS compatible input level. 7-bit I/O port. CMOS compatible input level. CMOS 3-state output structure. I/O direction register allows each pin to be individually programmed as either input or output. * Pull-up control is enabled. Function except a port function * Timer A output pin * PWM1 output (timer output) pin * External count I/O pins * External interrupt input pins I/O port P6 * * * * * * * * * * * * * * * P70/XCIN, P71/XCOUT I/O port P7 P80 - P87 I/O port P8 8-bit I/O port. CMOS compatible input level. CMOS 3-state output structure. I/O direction register allows each pin to be individually programmed as either input or output. Pull-up control is enabled. 2-bit I/O port. CMOS compatible input level. CMOS 3-state output structure. I/O direction register allows each pin to be individually programmed as either input or output. Pull-up control is enabled. 8-bit I/O port. TTL input level. CMOS 3-state output structure. I/O direction register allows each pin to be individually programmed as either input or output. Pull-up control is enabled. * A-D conversion input pins * Sub-clock generating circuit I/O pins * Key input (Key-on wake-up) interrupt input pins 38C3 Group User's Manual 1-5 HARDWARE PART NUMBERING PART NUMBERING Product M38C3 4 M 6A XXX FP Package type FP : 80P6N-A package FS : 80D0 package ROM number Omitted in One Time PROM version shipped in blank and EPROM version. A : Standard(Note) M : M version ROM/PROM size 1 : 4096 bytes 2 : 8192 bytes 3 : 12288 bytes 4 : 16384 bytes 5 : 20480 bytes 6 : 24576 bytes 7 : 28672 bytes 8 : 32768 bytes 9 : 36864 bytes A : 40960 bytes B : 45056 bytes C : 49152 bytes The first 128 bytes and the last 2 bytes of ROM are reserved areas ; they cannot be used. Memory type M : Mask ROM version E : EPROM or One Time PROM version RAM size 0 : 192 bytes 1 : 256 bytes 2 : 384 bytes 3 : 512 bytes 4 : 640 bytes 5 : 768 bytes 6 : 896 bytes 7 : 1024 bytes Note : Difference between standard and M version * Standard : Port P50/TAOUT pin remains set to the input mode until the direction register is set to the output mode during reset and after reset. * M version : Port P50/TAOUT pin remains set to the output mode ("L" output) until the direction register is set to the input mode during reset and after reset. Fig. 3 Part numbering 1-6 38C3 Group User's Manual HARDWARE GROUP EXPANSION GROUP EXPANSION Mitsubishi plans to expand the 38C3 group as follows. Packages 80P6N-A ..................................... 0.8 mm-pitch plastic molded QFP 80D0 ........................ 0.8 mm-pitch ceramic LCC (EPROM version) Memory Type Support for mask ROM, One Time PROM, and EPROM versions Memory Size ROM/PROM size ................................................ 16 K to 48 K bytes RAM size ............................................................. 512 to 1024 bytes Memory Expansion Plan ROM size (bytes) 48K 44K 40K 36K 32K 28K 24K 20K 16K 12K 8K 4K Planning M38C33M4 M38C34M6A/M6M Under development M38C34M8 M38C37ECA/ECM 192 256 384 512 640 768 896 1024 RAM size (bytes) Products under development or planning : the development schedule and specification may be revised without notice. Planning products may be stopped the development. Fig. 4 Memory expansion plan Currently supported products are listed below. Table 3 Support products Product name M38C34M6AXXXFP M38C37ECAXXXFP M38C37ECAFP M38C37ECAFS M38C34M6MXXXFP M38C37ECMXXXFP M38C37ECMFP M38C37ECMFS (P) ROM size (bytes) ROM size for User in ( ) 24576 (24446) 49152 (49022) 24576 (24446) 49152 (49022) RAM size (bytes) 640 1024 80D0 640 80P6N-A 1024 80D0 Package As of December 1998 Remarks Mask ROM version One Time PROM version One Time PROM version (blank) EPROM version Mask ROM version One Time PROM version One Time PROM version (blank) EPROM version 80P6N-A 38C3 Group User's Manual 1-7 HARDWARE FUNCTIONAL DESCRIPTION FUNCTIONAL DESCRIPTION Central Processing Unit (CPU) The 38C3 group uses the standard 740 Family instruction set. Refer to the table of 740 Family addressing modes and machine instructions or the 740 Family Software Manual for details on the instruction set. Machine-resident 740 Family instructions are as follows: The FST and SLW instructions cannot be used. The STP, WIT, MUL, and DIV instructions can be used. [Stack Pointer (S)] The stack pointer is an 8-bit register used during subroutine calls and interrupts. This register indicates start address of stored area (stack) for storing registers during subroutine calls and interrupts. The low-order 8 bits of the stack address are determined by the contents of the stack pointer. The high-order 8 bits of the stack address are determined by the stack page selection bit. If the stack page selection bit is "0" , the high-order 8 bits becomes "0016". If the stack page selection bit is "1", the high-order 8 bits becomes "0116". The operations of pushing register contents onto the stack and popping them from the stack are shown in Figure 6. Store registers other than those described in Figure 6 with program when the user needs them during interrupts or subroutine calls. [Accumulator (A)] The accumulator is an 8-bit register. Data operations such as data transfer, etc., are executed mainly through the accumulator. [Index Register X (X)] The index register X is an 8-bit register. In the index addressing modes, the value of the OPERAND is added to the contents of register X and specifies the real address. [Program Counter (PC)] The program counter is a 16-bit counter consisting of two 8-bit registers PCH and PCL. It is used to indicate the address of the next instruction to be executed. [Index Register Y (Y)] The index register Y is an 8-bit register. In partial instruction, the value of the OPERAND is added to the contents of register Y and specifies the real address. b7 A b7 X b7 Y b7 S b15 PCH b7 b7 PCL b0 Accumulator b0 Index register X b0 Index register Y b0 Stack pointer b0 Program counter b0 Processor status register (PS) Carry flag Zero flag Interrupt disable flag Decimal mode flag Break flag Index X mode flag Overflow flag Negative flag NVTBD I ZC Fig. 5 740 Family CPU register structure 1-8 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION On-going Routine Interrupt request (Note) Execute JSR M (S) Push return address on stack (S) M (S) (S) (PCH) (S) - 1 (PCL) (S)- 1 M (S) (S) M (S) (S) M (S) (S) (PCH) (S) - 1 (PCL) (S) - 1 (PS) (S) - 1 Push contents of processor status register on stack Push return address on stack Subroutine Execute RTS POP return address from stack (S) (PCL) (S) (PCH) (S) + 1 M (S) (S) + 1 M (S) Interrupt Service Routine Execute RTI (S) (PS) (S) (PCL) (S) (PCH) (S) + 1 M (S) (S) + 1 M (S) (S) + 1 M (S) I Flag is set from "0" to "1" Fetch the jump vector POP contents of processor status register from stack POP return address from stack Note: Condition for acceptance of an interrupt Interrupt enable flag is "1" Interrupt disable flag is "0" Fig. 6 Register push and pop at interrupt generation and subroutine call Table 4 Push and pop instructions of accumulator or processor status register Push instruction to stack Accumulator Processor status register PHA PHP Pop instruction from stack PLA PLP 38C3 Group User's Manual 1-9 HARDWARE FUNCTIONAL DESCRIPTION [Processor status register (PS)] The processor status register is an 8-bit register consisting of 5 flags which indicate the status of the processor after an arithmetic operation and 3 flags which decide MCU operation. Branch operations can be performed by testing the Carry (C) flag , Zero (Z) flag, Overflow (V) flag, or the Negative (N) flag. In decimal mode, the Z, V, N flags are not valid. *Bit 0: Carry flag (C) The C flag contains a carry or borrow generated by the arithmetic logic unit (ALU) immediately after an arithmetic operation. It can also be changed by a shift or rotate instruction. *Bit 1: Zero flag (Z) The Z flag is set if the result of an immediate arithmetic operation or a data transfer is "0", and cleared if the result is anything other than "0". *Bit 2: Interrupt disable flag (I) The I flag disables all interrupts except for the interrupt generated by the BRK instruction. Interrupts are disabled when the I flag is "1". *Bit 3: Decimal mode flag (D) The D flag determines whether additions and subtractions are executed in binary or decimal. Binary arithmetic is executed when this flag is "0"; decimal arithmetic is executed when it is "1". Decimal correction is automatic in decimal mode. Only the ADC and SBC instructions can be used for decimal arithmetic. *Bit 4: Break flag (B) The B flag is used to indicate that the current interrupt was generated by the BRK instruction. The BRK flag in the processor status register is always "0". When the BRK instruction is used to generate an interrupt, the processor status register is pushed onto the stack with the break flag set to "1". *Bit 5: Index X mode flag (T) When the T flag is "0", arithmetic operations are performed between accumulator and memory. When the T flag is "1", direct arithmetic operations and direct data transfers are enabled between memory locations. *Bit 6: Overflow flag (V) The V flag is used during the addition or subtraction of one byte of signed data. It is set if the result exceeds +127 to -128. When the BIT instruction is executed, bit 6 of the memory location operated on by the BIT instruction is stored in the overflow flag. *Bit 7: Negative flag (N) The N flag is set if the result of an arithmetic operation or data transfer is negative. When the BIT instruction is executed, bit 7 of the memory location operated on by the BIT instruction is stored in the negative flag. Table 5 Set and clear instructions of each bit of processor status register C flag Set instruction Clear instruction SEC CLC Z flag _ _ I flag SEI CLI D flag SED CLD B flag _ _ T flag SET CLT V flag _ CLV N flag _ _ 1-10 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION [CPU Mode Register (CPUM)] 003B16 The CPU mode register contains the stack page selection bit and the internal system clock selection bit etc. The CPU mode register is allocated at address 003B16. b7 b0 CPU mode register (CPUM (CM) : address 003B 16) Processor mode bits b1 b0 0 0 : Single-chip mode 0 1: 1 0 : Not available 1 1: Stack page selection bit 0 : RAM in the zero page is used as stack area 1 : RAM in page 1 is used as stack area Not used (returns "1" when read) (Do not write "0" to this bit.) Port XC switch bit 0 : I/O port 1 : XCIN, XCOUT Main clock ( XIN-XOUT) stop bit 0 : Operating 1 : Stopped Main clock division ratio selection bit 0 : f(XIN)/2 (high-speed mode) 1 : f(XIN)/8 (middle-speed mode) Internal system clock selection bit 0 : XIN-XOUT selected (middle-/high-speed mode) 1 : XCIN-XCOUT selected (low-speed mode) Fig. 7 Structure of CPU mode register 38C3 Group User's Manual 1-11 HARDWARE FUNCTIONAL DESCRIPTION MEMORY Special Function Register (SFR) Area The Special Function Register area in the zero page contains control registers such as I/O ports and timers. Zero Page Access to this area with only 2 bytes is possible in the zero page addressing mode. Special Page RAM RAM is used for data storage and for stack area of subroutine calls and interrupts. Access to this area with only 2 bytes is possible in the special page addressing mode. ROM The first 128 bytes and the last 2 bytes of ROM are reserved for device testing and the rest is user area for storing programs. Interrupt Vector Area The interrupt vector area contains reset and interrupt vectors. RAM area RAM size (bytes) 192 256 384 512 640 768 896 1024 Address XXXX16 00FF16 013F16 01BF16 023F16 02BF16 033F16 03BF16 043F16 XXXX16 Reserved area 044016 Not used ROM area ROM size (bytes) 4096 8192 12288 16384 20480 24576 28672 32768 36864 40960 45056 49152 Address YYYY16 F00016 E00016 D00016 C00016 B00016 A00016 900016 800016 700016 600016 500016 400016 Address ZZZZ16 F08016 E08016 D08016 C08016 B08016 A08016 908016 808016 708016 608016 508016 408016 FFFE16 Reserved ROM area FFFF16 Note 1 : This is valid only in mask ROM version. Interrupt vector area FFDC16 Special page ROM FF0016 ZZZZ16 0F0016 0FFF16 YYYY16 Reserved ROM area (128 bytes) SFR area 2 (Note 1) RAM 010016 000016 SFR area 1 004016 005016 005816 LCD display RAM area ROM corrective RAM area (Note 1) Zero page Fig. 8 Memory map diagram 1-12 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION 000016 Port P0 (P0) 000116 Port P0 direction register (P0D) 000216 Port P1 (P1) 000316 Port P1 direction register (P1D) 000416 Port P2 (P2) 000516 Port P2 direction register (P2D) 000616 Port P3 (P3) 000716 000816 Port P4 (P4) 000916 Port P4 direction register (P4D) 000A16 Port P5 (P5) 000B16 Port P5 direction register (P5D) 000C16 Port P6 (P6) 000D16 Port P6 direction register (P6D) 000E16 Port P7 (P7) 000F16 Port P7 direction register (P7D) 001016 Port P8 (P8) 001116 Port P8 direction register (P8D) 001216 001316 001416 001516 001616 PULL register A (PULLA) 001716 PULL register B (PULLB) 001816 Port P8 output selection register (P8SEL) 001916 Serial I/O control register 1 (SIOCON1) 001A16 Serial I/O control register 2 (SIOCON2) 001B16 Serial I/O register (SIO) 001C16 001D16 001E16 001F16 0F0116 ROM correct enable register 1 (Note) 0F0216 ROM correct high-order address register 1 (Note) 0F0316 ROM correct low-order address register 1 (Note) 0F0416 ROM correct high-order address register 2 (Note) 0F0516 ROM correct low-order address register 2 (Note) 0F0616 ROM correct high-order address register 3 (Note) 0F0716 ROM correct low-order address register 3 (Note) 0F0816 ROM correct high-order address register 4 (Note) 0F0916 ROM correct low-order address register 4 (Note) 002016 Timer 1 (T1) 002116 Timer 2 (T2) 002216 Timer 3 (T3) 002316 Timer 4 (T4) 002416 Timer 5 (T5) 002516 Timer 6 (T6) 002616 002716 Timer 6 PWM register (T6PWM) 002816 Timer 12 mode register (T12M) 002916 Timer 34 mode register (T34M) 002A16 Timer 56 mode register (T56M) 002B16 output control register (CKOUT) 002C16 Timer A register (low) (TAL) 002D16 Timer A register (high) (TAH) 002E16 Compare register (low) (CONAL) 002F16 Compare register (high) (CONAH) 003016 Timer A mode register (TAM) 003116 Timer A control register (TACON) 003216 A-D control register (ADCON) 003316 A-D conversion register (low) (ADL) 003416 A-D conversion register (high) (ADH) 003516 003616 003716 003816 Segment output enable register (SEG) 003916 LCD mode register (LM) 003A16 Interrupt edge selection register (INTEDGE) 003B16 CPU mode register (CPUM) 003C16 Interrupt request register 1 (IREQ1) 003D16 Interrupt request register 2 (IREQ2) 003E16 Interrupt control register 1 (ICON1) 003F16 Interrupt control register 2 (ICON2) 0F0A16 ROM correct high-order address register 5 (Note) 0F0B16 ROM correct low-order address register 5 (Note) 0F0C16 ROM correct high-order address register 6 (Note) 0F0D16 ROM correct low-order address register 6 (Note) 0F0E16 ROM correct high-order address register 7 (Note) 0F0F16 ROM correct low-order address register 7 (Note) 0F1016 ROM correct high-order address register 8 (Note) 0F1116 ROM correct low-order address register 8 (Note) Note: This register is valid only in mask ROM version. Fig. 9 Memory map of special function register (SFR) 38C3 Group User's Manual 1-13 HARDWARE FUNCTIONAL DESCRIPTION I/O PORTS [Direction Registers (ports P2, P4, P50, P52-P57, and P6-P8)] The I/O ports P2, P4, P50, P52-P57, and P6-P8 have direction registers which determine the input/output direction of each individual pin. Each bit in a direction register corresponds to one pin, each pin can be set to be input port or output port. When "0" is written to the bit corresponding to a pin, that pin becomes an input pin. When "1" is written to that bit, that pin becomes an output pin. If data is read from a pin set to output, the value of the port output latch is read, not the value of the pin itself. Pins set to input are floating. If a pin set to input is written to, only the port output latch is written to and the pin remains floating. b7 b0 PULL register A (PULLA : address 001616) P00-P07 pull-down P10-P17 pull-down P20-P27 pull-down Not used P70, P71 pull-up P80-P87 pull-up Not used (return "0" when read) b7 b0 PULL register B (PULLB : address 001716) P40-P43 pull-up P44-P47 pull-up P50, P52, P53 pull-up P54-P57 pull-up P60-P63 pull-up P64-P67 pull-up Not used (return "0" when read) 0 : Disable 1 : Enable [Direction Registers (ports P0 and P1)] Ports P0 and P1 have direction registers which determine the input/ output direction of each individual port. Each port in a direction register corresponds to one port, each port can be set to be input or output. When "0" is written to the bit 0 of a direction register, that port becomes an input port. When "1" is written to that port, that port becomes an output port. Bits 1 to 7 of ports P0 and P1 direction registers are not used. Note: The contents of PULL register A and PULL register B do not affect ports programmed as the output ports. Pull-up/Pull-down Control By setting the PULL register A (address 001616) or the PULL register B (address 001716), ports except for ports P3 and P51 can control either pull-down or pull-up (pins that are shared with the segment output pins for LCD are pull-down; all other pins are pull-up) with a program. However, the contents of PULL register A and PULL register B do not affect ports programmed as the output ports. Fig. 10 Structure of PULL register A and PULL register B b7 b0 Port P8 output selection register (P8SEL : address 001816) 0 : CMOS output (in output mode) 1 : N-channel open-drain output (in output mode) Port P8 Output Selection Ports P80 to P87 can be switched to N-channel open-drain output by setting "1" to the port P8 output selection register. Table 6 List of I/O port function (1) Pin P00/SEG8 - P07/SEG15 P10/SEG16 - P17/SEG23 P20/SEG0 - P27/SEG7 P30/SEG24 - P37/SEG31 Name Port P0 Input/Output Input/Output, port unit Input/Output, port unit Input/Output, individual bits Output, individual bits I/O format CMOS compatible input level CMOS 3-state output CMOS compatible input level CMOS 3-state output CMOS compatible input CMOS 3-state output CMOS 3-state output Non-port function LCD segment output Related SFRs Ref. No. PULL register A (1) Segment output enable register PULL register A Segment output enable register PULL register A Segment output enable register Segment output enable reg(2) ister Fig. 11 Structure of port P8 output selection register Port P1 LCD segment output Port P2 LCD segment output Port P3 LCD segment output 1-14 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION Table 7 List of I/O port function (2) Pin P40/SCLK2 Name Port P4 Input/Output Input/Output, individual bits I/O format CMOS compatible input level CMOS 3-state output Non-port function Serial I/O function I/O Related SFRs Ref. No. Serial I/O control registers (3) 1, 2 PULL register B Timer 12 mode register (4) PULL register B Timer 34 mode register (4) PULL register B output control register (5) PULL register B Serial I/O control registers (6) 1, 2 (7) PULL register B (8) (9) Timer A mode register (10) Timer A control register PULL register B (11) Timer 56 mode register PULL register B Interrupt edge selection register PULL register B Interrupt edge selection register PULL register B A-D control register PULL register B CPU mode register PULL register A Interrupt control register 2 PULL register A LCD mode register (4) P41/T1OUT P42/T3OUT P43/ P44/SIN P45/SOUT P46/SCLK1 P47/SRDY P50/TAOUT Port P5 Input/Output, individual bits Input Input/Output, individual bits CMOS compatible input level CMOS 3-state output CMOS compatible input level CMOS compatible input level CMOS 3-state output Timer output Timer output clock output Serial I/O function I/O Timer A output P51 P52/PWM1 PWM output P53/CNTR0 P54/CNTR1 P55/INT0 P56/INT1 P57/INT2 P60/AN0 - P67/AN7 P70/XCIN P71/XCOUT P80 - P87 Port P8 Input/Output, individual bits Output External count I/O (12) External interrupt input Port P6 Input/Output, individual bits Input/Output, individual bits CMOS compatible input level CMOS 3-state output CMOS compatible input level CMOS 3-state output CMOS compatible input level CMOS 3-state output LCD common output A-D converter input (12) (13) Port P7 Sub-clock generating circuit I/O Key input (key-on wake-up) interrupt input (14) (15) (17) COM0 - COM3 Common (16) Notes 1: Make sure that the input level at each pin is either 0 V or VCC during execution of the STP instruction. When an input level is at an intermediate potential, a current will flow from VCC to VSS through the input-stage gate. 2: For details of how to use double function ports as function I/O ports, refer to the applicable sections. 38C3 Group User's Manual 1-15 HARDWARE FUNCTIONAL DESCRIPTION (1)Ports P0, P1, P2 VL2/VL3 (2)Port P3 VL2/VL3 VL1/VSS Segment output enable bit (Note) VL1/VSS Segment output enable bit Direction register Data bus Port latch Data bus Port latch Pull-down control Pull-down control Segment output enable bit Note : Port P0, P1 direction registers are only bit 0. Segment output enable bit (3)Port P40 (4)Ports P41, P42, P52 P-channel output disable bit Serial I/O mode selection bit Direction register Pull-up control Timer 1 output selection bit Timer 3 output selection bit Timer 6 output selection bit Direction register Pull-up control Data bus Port latch Data bus Port latch Serial I/O clock output Timer 1 output Timer 3 output Timer 6 output (5)Port P43 (6)Port P44 Pull-up control Pull-up control Direction register Direction register Data bus Port latch Data bus Port latch output control bit Serial I/O input Fig. 12 Port block diagram (1) 1-16 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION (7)Port P45 Pull-up control P-channel output disable bit Serial I/O port selection bit Direction register (8)Port P46 P-channel output disable bit Serial I/O mode selection bit Direction register Pull-up control Data bus Port latch Data bus Port latch Serial I/O output Serial I/O clock output Serial I/O clock input (9)Port P47 (10)Port P50 Pull-up control Pull-up control Timer A output enable bit SRDY output enable bit Direction register (Note) Direction register Data bus Port latch Data bus Port latch Serial I/O ready output Timer A output (11)Port P51 (12)Ports P53-P57 Pull-up control Data bus Direction register Data bus Port latch Note: The initial value of M version becomes "1" (output). INT0-INT2 interrupt input CNTR0,CNTR1 interrupt input Fig. 13 Port block diagram (2) 38C3 Group User's Manual 1-17 HARDWARE FUNCTIONAL DESCRIPTION (13)Port P6 (14)Port P70 Pull-up control Port selection * pull-up control Port Xc switch bit Direction register Direction register Data bus Port latch Data bus Port latch A-D conversion input Analog input pin selection bit Sub-clock generating circuit input (15)Port P71 (16)COM0-COM3 Port selection * pull-up control Port Xc switch bit Direction register VL3 VL2 VL1 Data bus Port latch The gate input signal of each transistor is controlled by the LCD duty ratio and the bias value. Oscillator Port P70 Port Xc switch bit (17)Port P8 Pull-up control P-channel output disable bit Direction register Data bus Port latch Key input (key-on wake-up) interrupt input Fig. 14 Port block diagram (3) 1-18 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION INTERRUPTS Interrupts occur by sixteen sources: six external, nine internal, and one software. Interrupt Control Each interrupt except the BRK instruction interrupt have both an interrupt request bit and an interrupt enable bit, and is controlled by the interrupt disable flag. An interrupt occurs if the corresponding interrupt request and enable bits are "1" and the interrupt disable flag is "0". Interrupt enable bits can be set or cleared by software. Interrupt request bits can be cleared by software, but cannot be set by software. The BRK instruction interrupt and reset cannot be disabled with any flag or bit. The I flag disables all interrupts except the BRK instruction interrupt and reset. If several interrupts requests occurs at the same time the interrupt with highest priority is accepted first. Interrupt Operation By acceptance of an interrupt, the following operations are automatically performed: 1. The processing being executed is stopped. 2. The contents of the program counter and processor status register are automatically pushed onto the stack. 3. The interrupt disable flag is set and the corresponding interrupt request bit is cleared. 4. The interrupt jump destination address is read from the vector table into the program counter. sNotes on Interrupts When the active edge of an external interrupt (INT0 - INT2, CNTR0 or CNTR1) is set or an vector interrupt source where several interrupt source is assigned to the same vector address is switched, the corresponding interrupt request bit may also be set. Therefore, take following sequence: (1) Disable the interrupt. (2) Change the active edge in interrupt edge selection register. (3) Clear the set interrupt request bit to "0." (4) Enable the interrupt. 38C3 Group User's Manual 1-19 HARDWARE FUNCTIONAL DESCRIPTION Table 8 Interrupt vector addresses and priority Interrupt Source Priority Reset (Note 2) INT0 INT1 INT2 Serial I/O Timer A Timer 1 Timer 2 Timer 3 Timer 4 Timer 5 Timer 6 CNTR0 CNTR1 Key input (Keyon wake-up) A-D conversion BRK instruction 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Vector Addresses (Note 1) High Low FFFD16 FFFC16 FFFB16 FFF916 FFF716 FFF516 FFF316 FFF116 FFEF16 FFED16 FFEB16 FFE916 FFE716 FFE516 FFE316 FFE116 FFDF16 FFDD16 FFFA16 FFF816 FFF616 FFF416 FFF216 FFF016 FFEE16 FFEC16 FFEA16 FFE816 FFE616 FFE416 FFE216 FFE016 FFDE16 FFDC16 Interrupt Request Generating Conditions At reset At detection of either rising or falling edge of INT0 input At detection of either rising or falling edge of INT1 input At detection of either rising or falling edge of INT2 input At completion of serial I/O data transmit/receive At timer A underflow At timer 1 underflow At timer 2 underflow At timer 3 underflow At timer 4 underflow At timer 5 underflow At timer 6 underflow At detection of either rising or falling edge of CNTR0 input At detection of either rising or falling edge of CNTR1 input At falling of port P8 (at input) input logical level AND At completion of A-D conversion At BRK instruction execution Remarks Non-maskable External interrupt (active edge selectable) External interrupt (active edge selectable) External interrupt (active edge selectable) Valid when serial I/O is selected STP release timer underflow External interrupt (active edge selectable) External interrupt (active edge selectable) External interrupt (falling valid) Valid when A-D conversion interrupt is selected Non-maskable software interrupt Notes 1: Vector addresses contain interrupt jump destination addresses. 2: Reset function in the same way as an interrupt with the highest priority. 1-20 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION Interrupt request bit Interrupt enable bit Interrupt disable flag (I) BRK instruction Reset Interrupt request Fig. 15 Interrupt control b7 b0 Interrupt edge selection register (INTEDGE : address 003A16) INT0 interrupt edge selection bit INT1 interrupt edge selection bit 0 : Falling edge active INT2 interrupt edge selection bit 1 : Rising edge active Not used (return "0" when read) CNTR0 active edge switch bit 0 : Falling edge active, rising edge count CNTR1 active edge switch bit 1 : Rising edge active, falling edge count b7 b0 Interrupt request register 1 (IREQ1 : address 003C16) INT0 interrupt request bit INT1 interrupt request bit INT2 interrupt request bit Serial I/O interrupt request bit Timer A interrupt request bit Timer 1 interrupt request bit Timer 2 interrupt request bit Timer 3 interrupt request bit b7 b0 Interrupt request register 2 (IREQ2 : address 003D16) Timer 4 interrupt request bit Timer 5 interrupt request bit Timer 6 interrupt request bit CNTR0 interrupt request bit CNTR1 interrupt request bit Key input interrupt request bit AD conversion interrupt request bit Not used (returns "0" when read) 0 : No interrupt request issued 1 : Interrupt request issued b7 b0 Interrupt control register 1 (ICON1 : address 003E16) INT0 interrupt enable bit INT1 interrupt enable bit INT2 interrupt enable bit Serial I/O interrupt enable bit Timer A interrupt enable bit Timer 1 interrupt enable bit Timer 2 interrupt enable bit Timer 3 interrupt enable bit b7 b0 Interrupt control register 2 (ICON2 : address 003F16) Timer 4 interrupt enable bit Timer 5 interrupt enable bit Timer 6 interrupt enable bit CNTR0 interrupt enable bit CNTR1 interrupt enable bit Key input interrupt enable bit AD conversion interrupt enable bit Not used (returns "0" when read) (Do not write "1" to this bit) 0 : Interrupts disabled 1 : Interrupts enabled Fig. 16 Structure of interrupt-related registers 38C3 Group User's Manual 1-21 HARDWARE FUNCTIONAL DESCRIPTION Key Input Interrupt (Key-on Wake-Up) A key input interrupt request is generated by applying "L" level to any pin of port P8 that have been set to input mode. In other words, it is generated when AND of input level goes from "1" to "0". An example of using a key input interrupt is shown in Figure 17, where an interrupt request is generated by pressing one of the keys consisted as an active-low key matrix which inputs to ports P80-P83. Port PXx "L" level output PULL register A Bit 5 = "1" V VV Port P87 direction register = "1" Port P87 latch Key input interrupt request P87 output Port P86 direction register = "1" V VV Port P86 latch P86 output V VV Port P85 direction register = "1" Port P85 latch P85 output V VV Port P84 direction register = "1" Port P84 latch P84 output V VV Port P83 direction register = "0" Port P83 latch Port P8 Input reading circuit P83 input V VV Port P82 direction register = "0" Port P82 latch P82 input Port P81 direction register = "0" V VV P81 input Port P81 latch V Port P80 direction register = "0" VV P80 input Port P80 latch V P-channel transistor for pull-up V V CMOS output buffer Fig. 17 Connection example when using key input interrupt and port P8 block diagram 1-22 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION TIMERS 8-Bit Timer The 38C3 group has six built-in timers : Timer 1, Timer 2, Timer 3, Timer 4, Timer 5, and Timer 6. Each timer has the 8-bit timer latch. All timers are down-counters. When the timer reaches "0016," an underflow occurs with the next count pulse. Then the contents of the timer latch is reloaded into the timer and the timer continues down-counting. When a timer underflows, the interrupt request bit corresponding to that timer is set to "1." The count can be stopped by setting the stop bit of each timer to "1." The system clock can be set to either the high-speed mode or lowspeed mode with the CPU mode register. At the same time, timer internal count source is switched to either f(XIN) or f(XCIN). qTimer 1, Timer 2 The count sources of timer 1 and timer 2 can be selected by setting the timer 12 mode register. A rectangular waveform of timer 1 underflow signal divided by 2 is output from the P41/T1OUT pin. The waveform polarity changes each time timer 1 overflows. The active edge of the external clock CNTR0 can be switched with the bit 6 of the interrupt edge selection register. At reset or when executing the STP instruction, all bits of the timer 12 mode register are cleared to "0," timer 1 is set to "FF16," and timer 2 is set to "0116." qTimer 3, Timer 4 The count sources of timer 3 and timer 4 can be selected by setting the timer 34 mode register. A rectangular waveform of timer 3 underflow signal divided by 2 is output from the P42/T3OUT pin. The waveform polarity changes each time timer 3 overflows. The active edge of the external clock CNTR1 can be switched with the bit 7 of the interrupt edge selection register. qTimer 5, Timer 6 The count sources of timer 5 and timer 6 can be selected by setting the timer 56 mode register. A rectangular waveform of timer 6 underflow signal divided by 2 can be output from the P52/PWM1 pin. qTimer 6 PWM1 Mode Timer 6 can output a rectangular waveform with "H" duty cycle n/ (n+m) from the P52/PWM1 pin by setting the timer 56 mode register (refer to Figure 20). The n is the value set in timer 6 latch (address 002516) and m is the value in the timer 6 PWM register (address 002716). If n is "0," the PWM output is "L," if m is "0," the PWM output is "H" (n = 0 is prior than m = 0). In the PWM mode, interrupts occur at the rising edge of the PWM output. b7 b0 Timer 12 mode register (T12M: address 002816) Timer 1 count stop bit 0 : Count operation 1 : Count stop Timer 2 count stop bit 0 : Count operation 1 : Count stop Timer 1 count source selection bits 00 : f(XIN)/16 or f(XCIN)/16 01 : f(XCIN) 10 : f(XIN)/32 or f(XCIN)/32 11 : f(XIN)/128 or f(XCIN)/128 Timer 2 count source selection bits 00 : Underflow of Timer 1 01 : f(XCIN) 10 : External count input CNTR0 11 : Not available Timer 1 output selection bit (P41) 0 : I/O port 1 : Timer 1 output Not used (returns "0" when read) (Do not write "1" to this bit.) b7 b0 Timer 34 mode register (T34M: address 002916) Timer 3 count stop bit 0 : Count operation 1 : Count stop Timer 4 count stop bit 0 : Count operation 1 : Count stop Timer 3 count source selection bits 00 : f(XIN)/16 or f(XCIN)/16 01 : Underflow of Timer 2 10 : f(XIN)/32 or f(XCIN)/32 11 : f(XIN)/128 or f(XCIN)/128 Timer 4 count source selection bits 00 : f(XIN)/16 or f(XCIN)/16 01 : Underflow of Timer 3 10 : External count input CNTR1 11 : Not available Timer 3 output selection bit (P42) 0 : I/O port 1 : Timer 3 output Not used (returns "0" when read) (Do not write "1" to this bit.) b7 b0 Timer 56 mode register (T56M: address 002A16) Timer 5 count stop bit 0 : Count operation 1 : Count stop Timer 6 count stop bit 0 : Count operation 1 : Count stop Timer 5 count source selection bit 0 : f(XIN)/16 or f(XCIN)/16 1 : Underflow of Timer 4 Timer 6 operation mode selection bit 0 : Timer mode 1 : PWM mode Timer 6 count source selection bits 00 : f(XIN)/16 or f(XCIN)/16 01 : Underflow of Timer 5 10 : Underflow of Timer 4 11 : Not available Timer 6 (PWM) output selection bit (P5 2) 0 : I/O port 1 : Timer 6 output Not used (returns "0" when read) (Do not write "1" to this bit.) Fig. 18 Structure of timer related register 38C3 Group User's Manual 1-23 HARDWARE FUNCTIONAL DESCRIPTION Data bus XCIN 1/2 "1" XIN "0" Internal system clock selection bit Timer 1 latch (8) RESET STP instruction Timer 1 interrupt request Timer 1 count source Timer 1 (8) "01" selection bit "00" "10" "11" FF16 1/16 1/32 1/128 Timer 1 count stop bit P41/T1OUT P41 latch 1/2 Timer 1 output selection bit Timer 2 latch (8) P41 direction register Timer 2 count source selection bit Timer 2 (8) "00" "01" "10" 0116 Timer 2 interrupt request Timer 2 count stop bit P53/CNTR0 Rising/Falling active edge switch CNTR0 interrupt request Timer 3 latch (8) Timer 3 count source selection bit Timer 3 (8) Timer 3 count stop bit Timer 3 interrupt request "01" "00" P42/T3OUT P42 latch "10" "11" 1/2 Timer 3 output selection bit Timer 4 latch (8) P42 direction register "01" "00" "10" Timer 4 count source selection bit Timer 4 (8) Timer 4 count stop bit CNTR1 interrupt request Timer 4 interrupt request P54/CNTR1 Rising/Falling active edge switch Timer 5 latch (8) "1" "0" Timer 5 count source selection bit Timer 5 (8) Timer 5 count stop bit Timer 5 interrupt request Timer 6 latch (8) "01" "00" "10" Timer 6 count source selection bit Timer 6 (8) Timer 6 count stop bit Timer 6 interrupt request Timer 6 PWM register (8) P52/PWM1 P52 latch "1" "0" Timer 6 output selection bit PWM 1/2 Timer 6 operation mode selection bit P52 direction register Fig. 19 Block diagram of timer 1-24 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION ts Timer 6 count source Timer 6 PWM mode n ! ts (n+m) ! ts m ! ts Timer 6 interrupt request Note: PWM waveform (duty : n/(n+m) and period : (n+m) ! ts) is output. n: setting value of Timer 6 m: setting value of Timer 6 PWM register ts: period of Timer 6 count source Timer 6 interrupt request Fig. 20 Timing chart of timer 6 PWM1 mode 16-bit Timer Timer A is a 16-bit timer that can be selected in one of four modes by the timer A mode register and the timer A control register. qTimer A The timer A operates as down-count. When the timer contents reach "000016", an underflow occurs at the next count pulse and the timer latch contents are reloaded. After that, the timer continues countdown. When the timer underflows, the interrupt request bit corresponding to the timer A is set to "1". types of delay time by a delay circuit. When using this mode, set port P55 sharing the INT0 pin to input mode and set port P50 sharing the TAOUT pin to output mode. It is possible to force the timer A output to be "L" using pins INT1 and INT2 by the timer A control register. (4) PWM mode IGBT dummy output, an external trigger with the INT0 pin and output control with pins INT1 and INT2 are not used. Except for those, this mode operates just as in the IGBT output mode. The period of PWM waveform is specified by the timer A set value. The "H" term is specified by the compare register set value. When using this mode, set port P50 sharing the TAOUT pin to output mode. (1) Timer mode The count source can be selected by setting the timer A mode register. (2) Pulse output mode Pulses of which polarity is inverted each time the timer underflows are output from the TAOUT pin. Except for that, this mode operates just as in the timer mode. When using this mode, set port P50 sharing the TAOUT pin to output mode. (3) IGBT output mode After dummy output from the TAOUT pin, count starts with the INT0 pin input as a trigger. When the trigger is detected or the timer A underflows, "H" is output from the the TAOUT pin. When the count value corresponds with the compare register value, the TAOUT output becomes "L". When the INT0 signal becomes "H", the TAOUT output is forced to become "L". After noise is cleared by noise filters, judging continuous 4-time same levels with sampling clocks to be signals, the INT0 signal can use 4 38C3 Group User's Manual 1-25 HARDWARE FUNCTIONAL DESCRIPTION External trigger delay time selection bits 0s "00" 4/f(XIN) "01" 8/f(XIN) "10" 16/f(XIN) "11" Delay circuit Data bus INT0 Noise filter (4-time same levels judgement) Noise filter sampling clock selection bit Divider 1/2 1/4 1/1 1/2 1/4 1/8 Timer A count source selection bits Timer A operating mode bits "10" Internal trigger start "00", "01", "11" Timer A write control bit Timer A (high-order) latch (8) Timer A (low-order) latch (8) Timer A (high-order) (8) Timer A (low-order) (8) XIN Divider Timer A underflow interrupt request INT1 "1" "0" Timer A output control bit 1 Match Compare register (high-order) (8) Compare register (low-order) (8) "1" INT2 "0" Timer A output control bit 2 Timer A operating mode bits "00", "01", "11" "10" Timer A output active edge switch bit "0" R QS D Timer A start signal Pulse output mode S S T Q P50/TAOUT (Note) P50 direction register "1" Q IGBT output mode PWM mode P50 latch Output selection bit "0" Q "1" Timer A output active edge switch bit Note: The initial value of M version becomes "1" (output). Fig. 21 Block diagram of timer A b7 b0 b7 b0 Timer A mode register (TAM : address 003016) Timer A operating mode bits 00 : Timer mode 01 : Pulse output mode 10 : IGBT output mode 11 : PWM mode Timer A write control bit 0 : Write data to both timer latch and timer 1 : Write data to timer latch only Timer A count source selection bits 0 0 : f(XIN) 0 1 : f(XIN)/2 1 0 : f(XIN)/4 1 1 : f(XIN)/8 Timer A output active edge switch bit 0 : Output starts with "L" level 1 : Output starts with "H" level Timer A count stop bit 0 : Count operating 1 : Count stop Timer A output selection bit (P50) 0 : I/O port 1 : Timer A output Timer A control register (TACON : address 003116) Noise filter sampling clock selection bit 0 : f(XIN)/2 1 : f(XIN)/4 External trigger delay time selection bits 0 0 : No delay 0 1 : ( 4/f(XIN))s 1 0 : ( 8/f(XIN))s 1 1 : (16/f(XIN))s Timer A output control bit 1 (P56) 0 : Not used 1 : INT1 interrupt used Timer A output control bit 2 (P57) 0 : Not used 1 : INT2 interrupt used Not used (returns "0" when read) Fig. 22 Structure of timer A related registers 1-26 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION ts Timer A count source Timer A PWM mode IGBT output mode (n-m+1) ! ts (n+1) ! ts m ! ts Note: PWM waveform (duty : (n-m+1)/(n+1) and period : (n+1) ! ts) is output. n : setting value of Timer A m : setting value of compare register ts : period of Timer A count source Fig. 23 Timing chart of timer A PWM, IGBT output modes sNotes on Timer A (1) Write order to timer A * In the timer and pulse output modes, write to the timer A register (low-order) first and to the timer A register (high-order) next. Do not write to only one side. * In the IGBT and PWM modes, write to the registers as follows: the compare register (high- and low-order) the timer A register (low-order) the timer A register (high-order). It is possible to use whichever order to write to the compare register (high- and low-order). However, write both the compare register and the timer A register at the same time. (2) Read order to timer A * In all modes, read to the timer A register (high-order) first and to the timer A register (low-order) next. Read order to the compare register is not specified. * If reading to the timer A register during write operation or writing to it during read operation, normal operation will not be performed. (3) Write to timer A * When writing a value to the timer A address to write to the latch only, the value is set into the reload latch and the timer is updated at the next underflow. Normally, when writing a value to the timer A address, the value is set into the timer and the timer latch at the same time, because they are written at the same time. When writing to the latch only, if the write timing to the high-order reload latch and the underflow timing are almost the same, an expected value may be set in the high-order counter. * Do not switch the timer count source during timer count operation. Stop the timer count before switching it. Additionally, when performing write to the latch and the timer at the same time, the timer count value may change large. (4) Set of timer A mode register Set the write control bit to "1" (write to the latch only) when setting the IGBT and PWM modes. Output waveform simultaneously reflects the contents of both registers at the next underflow after writing to the timer A register (highorder). (5) Output control function of timer A When using the output control function (INT1 and INT2) in the IGBT mode, set the levels of INT1 and INT2 to "H" in the falling edge active or to "L" in the rising edge active before switching to the IGBT mode. 38C3 Group User's Manual 1-27 HARDWARE FUNCTIONAL DESCRIPTION SERIAL I/O The 38C3 group has a built-in 8-bit clock synchronous serial I/O. The I/O pins of serial I/O also operate as I/O port P4, and their function is selected by the serial I/O control register 1 (address 001916). XCIN Divider Internal system clock "1" selection bit 1/8 1/16 1/32 1/64 Internal synchronous clock selection bits Data bus XIN "0" P47 latch "0" Synchronous clock "1" selection bit 1/128 1/256 P47/SRDY SCLK SRDY Synchronous "1" circuit SRDY output selection bit External clock "0" P46 latch "0" P46/SCLK1 "1" Serial I/O port selection bit Serial I/O counter (3) Serial I/O interrupt request P45 latch "0" P45/SOUT "1" Serial I/O port selection bit P44/SIN P40 latch "0" Serial I/O shift register (8) P40/SCLK2 "1" Serial I/O port selection bit Fig. 24 Block diagram of serial I/O [Serial I/O Control Registers 1, 2 (SIOCON1, SIOCON2)] 001916, 001A16 Each of the serial I/O control registers 1, 2 contains 8 bits that select various control parameters of serial I/O. qOperation in serial I/O mode Either an internal clock or an external clock can be selected as the synchronous clock for serial I/O transfer. A dedicated divider is builtin as the internal clock, giving a choice of six clocks. When internal clock is selected, serial I/O starts to transfer by a write signal to the serial I/O register (address 001B16). After 8 bits have been transferred, the SOUT pin goes to high impedance. When external clock is selected, the clock must be controlled externally because the contents of the serial I/O register continue to shift while the transfer clock is input. In this case, the SOUT pin does not go to high impedance at the completion of data transfer. The interrupt request bit is set at the end of the transfer of 8 bits, regardless of whether the internal or external clock is selected. When selecting internal clock and setting "1" to SIOCON20, the P40 pin can be also used as synchronous clock output pin SCLK2. At this time, the SCLK1 pin can be used as I/O port. Table 9 Function of P46/SCLK1 and P40/SCLK2 SIOCON16 1 SIOCON13 1 SIOCON20 P46/SCLK1 P40/SCLK2 0 SCLK1 P40 P46 SCLK2 1 SIOCON13: Serial I/O port selection bit SIOCON16: Synchronous clock selection bit SIOCON20: Synchronous clock output pin selection bit 1-28 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION b7 b0 Serial I/O control register 1 (SIOCON1 : address 001916) Internal synchronous clock selection bits b2 b1 b0 0 0 0 : f(XIN)/8 or f(XCIN)/8 0 0 1 : f(XIN)/16 or f(XCIN)/16 0 1 0 : f(XIN)32 or f(XCIN)/32 0 1 1 : f(XIN)/64 or f(XCIN)/64 1 1 0 : f(XIN)/128 or f(XCIN)/128 1 1 1 : f(XIN)/256 or f(XCIN)/256 Serial I/O port selection bit (P40, P45, P46) 0 : I/O port 1 : SOUT, SCLK1, SCLK2 signal pin SRDY output selection bit (P47) 0 : I/O port 1 : SRDY signal pin Transfer direction selection bit 0 : LSB first 1 : MSB first Synchronous clock selection bit 0 : External clock 1 : Internal clock P-channel output disable bit (P40, P45, P46) 0 : CMOS output (in output mode) 1 : N-channel open-drain (in output mode) b7 b0 Serial I/O control register 2 (SIOCON2: address 001A16) Synchronous clock output pin selection bit 0 : SCLK1 1 : SCLK2 Not used (returns "0" when read) Fig. 25 Structure of serial I/O control register Synchronous clock Transfer clock Serial I/O register write signal Serial I/O output SOUT Serial I/O input SIN Receive enable signal SRDY Note: When internal clock is selected, the SOUT pin goes to high impedance after transfer ends. Interrupt request bit set (Note) D0 D1 D2 D3 D4 D5 D6 D7 Fig. 26 Serial I/O timing (for LSB first) 38C3 Group User's Manual 1-29 HARDWARE FUNCTIONAL DESCRIPTION A-D CONVERTER The 38C3 group has a 10-bit A-D converter. The A-D converter performs successive approximation conversion. Note that the comparator is constructed linked to a capacitor, so set f(XIN) to at least 500 kHz during A-D conversion. Use a CPU system clock dividing the main clock XIN as the internal system clock. [A-D Conversion Register (AD)] 003316, 003416 One of these registers is a high-order register, and the other is a loworder register. The high-order 8 bits of a conversion result is stored in the A-D conversion register (high-order) (address 003416), and the low-order 2 bits of the same result are stored in bit 7 and bit 6 of the A-D conversion register (low-order) (address 003316). During A-D conversion, do not read these registers. b7 b0 A-D control register (ADCON: address 003216) [A-D Control Register (ADCON)] 003216 This register controls A-D converter. Bits 2 to 0 are analog input pin selection bits. Bit 4 is an AD conversion completion bit and "0" during A-D conversion. This bit is set to "1" upon completion of A-D conversion. A-D conversion is started by setting "0" in this bit. Analog input pin selection bits 000: P60/AN0 001: P61/AN1 010: P62/AN2 011: P63/AN3 100: P64/AN4 101: P65/AN5 110: P66/AN6 111: P67/AN7 Not used (returns "0" when read) AD conversion completion bit 0: Conversion in progress 1: Conversion completed Not used (returns "0" when read) [Comparison Voltage Generator] The comparison voltage generator divides the voltage between AVSS and VREF, and outputs the divided voltages. b7 b0 A-D conversion register (high-order) (ADH: address 003416) AD conversion result stored bits [Channel Selector] The channel selector selects one of the input ports P67/AN7-P60/ AN0 and inputs it to the comparator. [Comparator and Control Circuit] The comparator and control circuit compares an analog input voltage with the comparison voltage and stores the result in the A-D conversion register. When an A-D conversion is completed, the control circuit sets the AD conversion completion bit and the AD conversion interrupt request bit to "1." b7 b0 A-D conversion register (low-order) (ADL: address 003316) Not used (returns "0" when read) AD conversion result stored bits Fig. 27 Structure of A-D control register Data bus b7 b0 A-D control register 3 P60/AN0 P61/AN1 P62/AN2 P63/AN3 P64/AN4 P65/AN5 P66/AN6 P67/AN7 Channel selector A-D control circuit A-D interrupt request Comparator A-D conversion register (H) A-D conversion register (L) (Address 0034 16) (Address 0033 16) Resistor ladder AVSS VREF Fig. 28 Block diagram of A-D converter 1-30 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION LCD DRIVE CONTROL CIRCUIT The 38C3 group has the built-in Liquid Crystal Display (LCD) drive control circuit consisting of the following. * LCD display RAM * Segment output enable register * LCD mode register * Selector * Timing controller * Common driver * Segment driver * Bias control circuit A maximum of 32 segment output pins and 4 common output pins can be used. Up to 128 pixels can be controlled for a LCD display. When the LCD enable bit is set to "1" after data is set in the LCD mode register, the segment output enable register, and the LCD display RAM, the LCD drive control circuit starts reading the display data automatically, performs the bias control and the duty ratio control, and displays the data on the LCD panel. Table 10 Maximum number of display pixels at each duty ratio Duty ratio 1 2 3 4 Maximum number of display pixels 32 dots or 8 segment LCD 4 digits 64 dots or 8 segment LCD 8 digits 96 dots or 8 segment LCD 12 digits 128 dots or 8 segment LCD 16 digits b7 b0 Segment output enable register (SEG : address 003816) Segment output enable bit 0 0 : I/O ports P20-P23 1 : Segment output SEG0-SEG3 Segment output enable bit 1 0 : I/O ports P24-P27 1 : Segment output SEG4-SEG7 Segment output enable bit 2 0 : I/O ports P00-P03 1 : Segment output SEG8-SEG11 Segment output enable bit 3 0 : I/O ports P04-P07 1 : Segment output SEG12-SEG15 Segment output enable bit 4 0 : I/O ports P10-P13 1 : Segment output SEG16-SEG19 Segment output enable bit 5 0 : I/O ports P14-P17 1 : Segment output SEG20-SEG23 Segment output enable bit 6 0 : Output ports P30-P33 1 : Segment output SEG24-SEG27 Segment output enable bit 7 0 : Output ports P34-P37 1 : Segment output SEG28-SEG31 b7 b0 LCD mode register (LM : address 003916) Duty ratio selection bits 0 0 : 1 (use COM0) 0 1 : 2 (use COM0,COM1) 1 0 : 3 (use COM0-COM2) 1 1 : 4 (use COM0-COM3) Bias control bit 0 : 1/3 bias 1 : 1/2 bias LCD enable bit 0 : LCD OFF 1 : LCD ON Not used (returns "0" when read) (Do not write "1" to this bit.) LCD circuit divider division ratio selection bits 0 0 : Clock input 0 1 : 2 division of clock input 1 0 : 4 division of clock input 1 1 : 8 division of clock input LCDCK count source selection bit (Note) 0 : f(XCIN)/32 1 : f(XIN)/8192 (f(XCIN)/8192 in low-speed mode) Note : LCDCK is a clock for a LCD timing controller. Fig. 29 Structure of LCD related registers 38C3 Group User's Manual 1-31 1-32 LCD enable bit Address 004F16 LCD display RAM LCD circuit divider division ratio selection bits 2 Bias control bit 2 Duty ratio selection bits LCDCK count source selection bit f(XIN)/8192 "1" (f(XCIN)/8192 in low-speed mode) LCD divider f(XCIN)/32 "0" Selector Selector Timing controller LCDCK Segment Segment driver driver Bias control Common driver Common driver Common driver Common driver HARDWARE Data bus FUNCTIONAL DESCRIPTION Fig. 30 Block diagram of LCD controller/driver Address 004016 Address 004116 Selector Selector Selector Selector 38C3 Group User's Manual P04/SEG12 P36/SEG30 P37/SEG31 VSS VL1 VL2 VL3 COM0 COM1 COM2 COM3 Segment Segment Segment Segment driver driver driver driver P20/SEG0 P21/SEG1 P22/SEG2 P23/SEG3 HARDWARE FUNCTIONAL DESCRIPTION Bias Control and Applied Voltage to LCD Power Input Pins To the LCD power input pins (VL1-VL3), apply the voltage value shown in Table 11 according to the bias value. Select a bias value by the bias control bit (bit 2 of the LCD mode register). Table 11 Bias control and applied voltage to VL1-VL3 Bias value 1/3 bias 1/2 bias 1/1 bias (1-duty ratio) Voltage value VL3=VLCD VL2=2/3 VLCD VL1=1/3 VLCD VL3=VLCD VL2=VL1=1/2 VLCD VL3=VLCD VL2=VL1=VSS Common Pin and Duty Ratio Control The common pins (COM0-COM3) to be used are determined by duty ratio. Select duty ratio by the duty ratio selection bits (bits 0 and 1 of the LCD mode register). When selecting 1-duty ratio, 1/1 bias can be used. Note 1: VLCD is the maximum value of supplied voltage for the LCD panel. Table 12 Duty ratio control and common pins used Duty ratio 1 2 3 4 Duty ratio selection bit Bit 1 Bit 0 0 0 0 1 1 0 1 1 Common pins used COM0 (Note 1) COM0, COM1 (Note 2) COM0-COM2 (Note 3) COM0-COM3 Notes 1: COM1, COM2, and COM3 are open. 2: COM2 and COM3 are open. 3: COM3 is open. Contrast control Contrast control Contrast control VL3 R1 VL2 R2 VL1 R3 VL3 R4 VL2 VL3 VL2 VL1 R5 VL1 R6 R1 = R2 = R3 1/3 bias 1/2 bias R4 = R5 1/1 bias Fig. 31 Example of circuit at each bias 38C3 Group User's Manual 1-33 HARDWARE FUNCTIONAL DESCRIPTION LCD Display RAM Address 004016 to 004F16 is the designated RAM for the LCD display. When "1" are written to these addresses, the corresponding segments of the LCD display panel are turned on. LCD Drive Timing The LCDCK timing frequency (LCD drive timing) is generated internally and the frame frequency can be determined with the following equation; f(LCDCK)= (frequency of count source for LCDCK) (divider division ratio for LCD) f(LCDCK) duty ratio Frame frequency= Bit 7 Address 004016 004116 004216 004316 004416 004516 004616 004716 004816 004916 004A16 004B16 004C16 004D16 004E16 004F16 6 SEG1 SEG3 SEG5 SEG7 SEG9 SEG11 SEG13 SEG15 SEG17 SEG19 SEG21 SEG23 SEG25 5 4 3 2 SEG0 SEG2 SEG4 SEG6 SEG8 SEG10 SEG12 SEG14 SEG16 SEG18 SEG20 SEG22 SEG24 1 0 SEG27 SEG26 SEG29 SEG28 SEG31 SEG30 COM3 COM2 COM1 COM0 COM3 COM2 COM1 COM0 Fig. 32 LCD display RAM map 1-34 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION Internal signal LCDCK timing 1/4 duty COM0 COM1 COM2 COM3 SEG0 VL3 VSS OFF COM3 1/3 duty COM0 COM1 COM2 VL3 VSS ON COM0 1/2 duty COM0 COM1 SEG0 ON COM1 OFF COM0 ON COM1 OFF COM0 ON COM1 OFF COM0 ON COM1 OFF COM0 VL3 VSS VL3 VL2=VL1 VSS OFF COM2 COM1 ON COM0 OFF COM2 COM1 ON COM0 OFF COM2 VL3 VL2=VL1 VSS COM2 COM1 ON COM0 COM3 OFF COM2 COM1 ON COM0 Voltage level VL3 VL2=VL1 VSS SEG0 1/1 duty (1/1 bias) VL3 COM0 SEG0 VL2=VL1=VSS VL3 VSS OFF ON Fig. 33 LCD drive waveform (1/2 bias) 38C3 Group User's Manual 1-35 HARDWARE FUNCTIONAL DESCRIPTION Internal signal LCDCK timing 1/4 duty Voltage level COM0 VL3 VL2 VL1 VSS COM1 COM2 COM3 SEG0 VL3 VSS OFF COM3 1/3 duty COM0 COM1 COM2 VL3 VSS ON COM0 1/2 duty COM0 COM1 SEG0 VL3 VSS ON COM1 OFF COM0 ON COM1 OFF COM0 ON COM1 OFF COM0 ON COM1 OFF COM0 VL3 VL2 VL1 VSS OFF COM2 COM1 ON COM0 OFF COM2 COM1 ON COM0 OFF COM2 VL3 VL2 VL1 VSS COM2 COM1 ON COM0 COM3 OFF COM2 COM1 ON COM0 SEG0 Fig. 34 LCD drive waveform (1/3 bias) 1-36 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION CLOCK OUTPUT FUNCTION The internal system clock can be output from port P43 by setting the output control register. Set "1" to bit 3 of the port P4 direction register when outputting clock. b7 b0 output control register (CKOUT : address 002B16) output control bit 0 : Port function 1 : clock output Not used (return "0" when read) Fig. 35 Structure of output control register 38C3 Group User's Manual 1-37 HARDWARE FUNCTIONAL DESCRIPTION ROM CORRECTION FUNCTION (Mask ROM version only) The 38C3 group has the ROM correction function correcting data at the arbitrary addresses in the ROM area. ROM correct high-order address register 1 ROM correct low-order address register 1 ROM correct high-order address register 2 ROM correct low-order address register 2 ROM correct high-order address register 3 ROM correct low-order address register 3 ROM correct high-order address register 4 ROM correct low-order address register 4 ROM correct high-order address register 5 ROM correct low-order address register 5 0F0216 0F0316 0F0416 0F0516 0F0616 0F0716 0F0816 0F0916 0F0A16 0F0B16 [ROM correct address register] 0F0216 - 0F1116 This is the register to store the address performing ROM correction. There are two types of registers to correct up to 8 addresses: one is the register to store the high-order address and the other is to store the low-order address. [ROM correct enable register 1 (RC1)] 0F0116 This is the register to enable the ROM correction function. When setting the bit corresponding to the ROM correction address to "1", the ROM correction function is enabled. It becomes invalid to the addresses of which corresponding bit is "0". All bits are "0" at the initial state. 0F0C16 ROM correct high-order address register 6 0F0D16 ROM correct low-order address register 6 0F0E16 0F0F16 0F1016 0F1116 ROM correct high-order address register 7 ROM correct low-order address register 7 ROM correct high-order address register 8 ROM correct low-order address register 8 [ROM correct data] This is the register to store a correct data for the address specified by the ROM correct address register. Fig. 36 Structure of ROM correct address register 005016 ROM correct data 1 ROM correct data 2 ROM correct data 3 ROM correct data 4 ROM correct data 5 ROM correct data 6 ROM correct data 7 ROM correct data 8 sNotes on ROM correction function 1. To use the ROM correction function, transfer data to each ROM correct data register in the initial setting. 2. Do not specify the same addresses in the ROM correct address register. 005116 005216 005316 005416 005516 005616 005716 Fig. 37 Structure of ROM correct data b7 b0 ROM correct enable register 1(address 0F01 16) RC1 ROM correct address 1 enable bit 0 : Disabled 1 : Enabled ROM correct address 2 enable bit 0 : Disabled 1 : Enabled ROM correct address 3 enable bit 0 : Disabled 1 : Enabled ROM correct address 4 enable bit 0 : Disabled 1 : Enabled ROM correct address 5 enable bit 0 : Disabled 1 : Enabled ROM correct address 6 enable bit 0 : Disabled 1 : Enabled ROM correct address 7 enable bit 0 : Disabled 1 : Enabled ROM correct address 8 enable bit 0 : Disabled 1 : Enabled Fig. 38 Structure of ROM correct enable register 1 1-38 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION RESET CIRCUIT ______ Poweron Power source voltage 0V Reset input voltage 0V (Note) To reset the microcomputer, RESET pin should be held at an "L" level ______ for 2 s or more. Then the RESET pin is returned to an "H" level (the power source voltage should be between 2.5 V and 5.5 V (M version: 2.2V V to 5.5 V), and the oscillation should be stable), reset is released. After the reset is completed, the program starts from the address contained in address FFFD16 (high-order byte) and address FFFC16 (low-order byte). Make sure that the reset input voltage is less than 0.5 V for VCC of 2.5 V (M version: less than 0.44 V for Vcc of 2.2V V) when switching to the high-speed mode, a power source voltage must be between 4.0 V and 5.5 V. RESET VCC 0.2VCC Note : Reset release voltage ; Vcc=2.5 V (M version is 2.2 V.) RESET VCC Power source voltage detection circuit Fig. 39 Reset circuit example XIN RESET Internal reset Reset address from vector table Address Data ? ? ? ? FFFC ADL FFFD ADH, ADL ADH SYNC XIN : about 8000 cycles Note 1: The frequency relation of f(XIN) and f() is f(XIN) = 8 * f(). 2: The question marks (?) indicate an undefined state that depends on the previous state. Fig. 40 Reset sequence 38C3 Group User's Manual 1-39 HARDWARE FUNCTIONAL DESCRIPTION Address Register contents (1) Port P0 (2) Port P0 direction register (3) Port P1 (4) Port P1 direction register (5) Port P2 (6) Port P2 direction register (7) Port P3 (8) Port P4 (9) Port P4 direction register (10) Port P5 (11) Port P5 direction register (12) Port P6 (13) Port P6 direction register (14) Port P7 (15) Port P7 direction register (16) Port P8 (17) Port P8 direction register (18) PULL register A (19) PULL register B 000016 000116 000216 000316 000416 000516 000616 000816 000916 000A16 000B16 000C16 000D16 000E16 000F16 001016 001116 001616 001716 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0F16 0016 0016 0016 0016 FF16 0116 FF16 FF16 FF16 FF16 0016 0016 0016 0016 FF16 (34) Timer A register (high-order) (35) Compare register (low-order) (36) Compare register (high-order) (37) Timer A mode register (38) Timer A control register (39) A-D control register (40) Segment output enable register (41) LCD mode register (42) Interrupt edge selection register (43) CPU mode register (44) Interrupt request register 1 (45) Interrupt request register 2 (46) Interrupt control register 1 (47) Interrupt control register 2 (48) ROM correct enable register 1 (49) ROM correct high-order address register 1 (50) ROM correct low-order address register 1 (51) ROM correct high-order address register 2 (52) ROM correct low-order address register 2 (53) ROM correct high-order address register 3 (54) ROM correct low-order address register 3 (55) ROM correct high-order address register 4 (56) ROM correct low-order address register 4 (57) ROM correct high-order address register 5 (58) ROM correct low-order address register 5 (59) ROM correct high-order address register 6 (60) ROM correct low-order address register 6 (61) ROM correct high-order address register 7 (62) ROM correct low-order address register 7 (63) ROM correct high-order address register 8 (64) ROM correct low-order address register 8 (65) Processor status register (66) Program counter Address Register contents 002D16 002E16 002F16 003016 003116 003216 003816 003916 003A16 FF16 0016 0016 0016 0016 1016 0016 0016 0016 003B16 0 1 0 0 1 0 0 0 003C16 003D16 003E16 003F16 0F0116 0F0216 0F0316 0F0416 0F0516 0F0616 0F0716 0F0816 0F0916 0F0A16 0F0B16 0F0C16 0F0D16 0F0E16 0F0F16 0F1016 0F1116 0016 0016 0016 0016 0016 FF16 FF16 FF16 FF16 FF16 FF16 FF16 FF16 FF16 FF16 FF16 FF16 FF16 FF16 FF16 FF16 (20) Port P8 output selection register 001816 (21) Serial I/O control register 1 (22) Serial I/O control register 2 (23) Timer 1 (24) Timer 2 (25) Timer 3 (26) Timer 4 (27) Timer 5 (28) Timer 6 (29) Timer 12 mode register (30) Timer 34 mode register (31) Timer 56 mode register (32) output control register (33) Timer A register (low-order) 001916 001A16 002016 002116 002216 002316 002416 002516 002816 002916 002A16 002B16 002C16 (PS) ! ! ! ! ! 1 ! ! (PCH) (PCL) FFFD16 contents FFFC16 contents X: Not fixed Since the initial values for other than above mentioned registers and RAM contents are indefinite at reset, they must be set. In the M version, bit 0 of the port P5 direction register becomes "1." Fig. 41 Internal status at reset 1-40 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION CLOCK GENERATING CIRCUIT The 38C3 group has two built-in oscillation circuits. An oscillation circuit can be formed by connecting a resonator between XIN and XOUT (XCIN and XCOUT). Use the circuit constants in accordance with the resonator manufacturer's recommended values. No external resistor is needed between XIN and XOUT since a feedback resistor exists on-chip. However, an external feedback resistor is needed between XCIN and XCOUT. Immediately after power on, only the XIN oscillation circuit starts oscillating, and XCIN and XCOUT pins function as I/O ports. Oscillation control (1) Stop mode If the STP instruction is executed, the internal system clock stops at an "H" level, and XIN and XCIN oscillators stop. Timer 1 is set to "FF16" and timer 2 is set to "0116." Either XIN divided by 16 or XCIN divided by 16 is input to timer 1 as count source, and the output of timer 1 is connected to timer 2. The bits of the timer 12 mode register are cleared to "0." Set the interrupt enable bits of the timer 1 and timer 2 to disabled ("0") before executing the STP instruction. Oscillator restarts when an external interrupt is received, but the internal system clock is not supplied to the CPU until timer 2 underflows. This allows time for the clock circuit oscillation to stabilize. Frequency control (1) Middle-speed mode The internal system clock is the frequency of XIN divided by 8. After reset, this mode is selected. (2) Wait mode If the WIT instruction is executed, the internal system clock stops at an "H" level. The states of XIN and XCIN are the same as the state before executing the WIT instruction. The internal system clock restarts at reset or when an interrupt is received. Since the oscillator does not stop, normal operation can be started immediately after the clock is restarted. (2) High-speed mode The internal system clock is the frequency of XIN divided by 2. (3) Low-speed mode The internal system clock is the frequency of XCIN divided by 2. sNotes on clock generating circuit If you switch the mode between middle/high-speed and low-speed, stabilize both XIN and XCIN oscillations. The sufficient time is required for the sub clock to stabilize, especially immediately after power on and at returning from stop mode. When switching the mode between middle/high-speed and low-speed, set the frequency on condition that f(XIN) > 3f(XCIN). XCIN Rf XCOUT Rd CCOUT XIN XOUT CCIN CIN COUT Fig. 42 Ceramic resonator circuit XCIN Rf XCOUT Rd XIN XOUT open External oscillation circuit VCC VSS CCIN CCOUT Fig. 43 External clock input circuit 38C3 Group User's Manual 1-41 HARDWARE FUNCTIONAL DESCRIPTION XCIN XCOUT "1" "0" Port XC switch bit XIN XOUT Internal system clock selection bit (Note) Low-speed mode "1" 1/2 "0" Middle-/High-speed mode 1/4 1/2 Timer 1 Timer 2 "1" Main clock division ratio selection bit Middle-speed mode Timing (Internal system clock) "0" High-speed mode or Low-speed mode Main clock stop bit Q S R WIT instruction S R Q Q S STP instruction STP instruction R Reset Interrupt disable flag I Interrupt request Note : When using the low-speed mode, set the port X C switch bit to "1" . Fig. 44 Clock generating circuit block diagram 1-42 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION Reset Middle-speed mode (f()=1 MHz) CM7=0(8 MHz selected) CM6=1(middle-speed) CM5=0(8 MHz oscillating) CM4=0(32 kHz stopped) High-speed mode CM6 "1" "0" (f() =4 MHz) CM7=0(8 MHz selected) CM6=0(high-speed) CM5=0(8 MHz oscillating) CM4=0(32 kHz stopped) "0" 4 "0" CM 6 0" " M" "1 C " "1 CM4 "0 "1 " " CM 4 CM "1 6 " "0 " CM4 High-speed mode (f() =4 MHz) CM7=0(8 MHz selected) CM6=0(high-speed) CM5=0(8 MHz oscillating) CM4=1(32 kHz oscillating) Middle-speed mode ((f()=1 MHz) CM7=0(8 MHz selected) CM6=1(middle-speed) CM5=0(8 MHz oscillating) CM4=1(32 kHz oscillating) "1" CM6 "1" "0" CM7 "0" CM7 "1" Low-speed mode Low-speed mode ((f()=16 kHz) CM7=1(32 kHz selected) CM6=1(middle-speed) CM5=0(8 MHz oscillating) CM4=1(32 kHz oscillating) CM6 "1" "0" (f() =16 kHz) CM7=1(32 kHz selected) CM6=0(high-speed) CM5=0(8 MHz oscillating) CM4=1(32 kHz oscillating) "1" "0" "1" "0" b7 b4 CPU mode register (CPUM : address 003B 16) CM4 : Port Xc switch bit 0: I/O port function 1: XCIN-XCOUT oscillating function CM5 : Main clock (XIN- XOUT) stop bit 0: Oscillating 1: Stopped CM6: Main clock division ratio selection bit 0: f(XIN)/2(High-speed mode) 1: f(XIN)/8 (Middle-speed mode) CM7: Internal system clock selection bit 0: XIN-XOUT selected (Middle-/High-speed mode) 1: XCIN-XCOUT selected (Low-speed mode) "0" CM5 "1" " Low-speed mode ((f()=16 kHz) CM7=1(32 kHz selected) CM6=1(middle-speed) CM5=1(8 MHz stopped) CM4=1(32 kHz oscillating) Low-speed mode CM6 "1" "0" (f() =16 kHz) CM7=1(32 kHz selected) CM6=0(high-speed) CM5=1(8 MHz stopped) CM4=1(32 kHz oscillating) Notes 1: Switch the mode by the allows shown between the mode blocks. (Do not switch between the mode directly without an allow.) 2: The all modes can be switched to the stop mode or the wait mode and return to the source mode when the stop mode or the wait mode is ended. 3: Timer,LCD operate in the wait mode. 4: When the stop mode is ended, a delay of approximately 1 ms occurs by connecting Timer 1 and Timer 2 in middle-/high-speed mode. 5: When the stop mode is ended, a delay of approximately 0.25 s occurs in low-speed mode. 6: Wait until oscillation stabilizes after oscillating the main clock X IN before the switching from the low-speed mode to middle/high-speed mode. 7: The example assumes that 8 MHz is being applied to the X IN pin and 32 kHz to the X CIN pin. indicates the internal system clock. Fig. 45 State transitions of system clock 38C3 Group User's Manual "1" "1 " CM 1" 6 "0 " "1 " CM5 C M "0 5 " "0 " CM 5 CM "1 6 " "0 " "0" 1-43 HARDWARE NOTES ON PROGRAMMING/NOTES ON USE NOTES ON PROGRAMMING Processor Status Register The contents of the processor status register (PS) after a reset are undefined, except for the interrupt disable flag (I) which is "1." After a reset, initialize flags which affect program execution. In particular, it is essential to initialize the index X mode (T) and the decimal mode (D) flags because of their effect on calculations. A-D Converter The comparator uses internal capacitors whose charge will be lost if the clock frequency is too low. Therefore, make sure that f(XIN) is at least on 500 kHz during an A-D conversion. Do not execute the STP or WIT instruction during an A-D conversion. Instruction Execution Time Interrupts The contents of the interrupt request bits do not change immediately after they have been written. After writing to an interrupt request register, execute at least one instruction before performing a BBC or BBS instruction. The instruction execution time is obtained by multiplying the frequency of the internal system clock by the number of cycles needed to execute an instruction. The number of cycles required to execute an instruction is shown in the list of machine instructions. The frequency of the internal system clock is the same half of the XIN frequency in high-speed mode. Decimal Calculations * To calculate in decimal notation, set the decimal mode flag (D) to "1," then execute an ADC or SBC instruction. After executing an ADC or SBC instruction, execute at least one instruction before executing a SEC, CLC, or CLD instruction. * In decimal mode, the values of the negative (N), overflow (V), and zero (Z) flags are invalid. At STP Instruction Release At the STP instruction release, all bits of the timer 12 mode register are cleared. NOTES ON USE Notes on Built-in EPROM Version The P51 pin of the One Time PROM version or the EPROM version functions as the power source input pin of the internal EPROM. Therefore, this pin is set at low input impedance, thereby being affected easily by noise. To prevent a malfunction due to noise, insert a resistor (approx. 5 k) in series with the P51 pin. Timers If a value n (between 0 and 255) is written to a timer latch, the frequency division ratio is 1/(n+1). Multiplication and Division Instructions * The index X mode (T) and the decimal mode (D) flags do not affect the MUL and DIV instruction. * The execution of these instructions does not change the contents of the processor status register. Ports The contents of the port direction registers cannot be read. The following cannot be used: * The data transfer instruction (LDA, etc.) * The operation instruction when the index X mode flag (T) is "1" * The addressing mode which uses the value of a direction register as an index * The bit-test instruction (BBC or BBS, etc.) to a direction register * The read-modify-write instructions (ROR, CLB, or SEB, etc.) to a direction register. Use instructions such as LDM and STA, etc., to set the port direction registers. Serial I/O * Using an external clock When using an external clock, input "H" to the external clock input pin and clear the serial I/O interrupt request bit before executing serial I/O transfer and serial I/O automatic transfer. * Using an internal clock When using an internal clock, set the synchronous clock to the internal clock, then clear the serial I/O interrupt request bit before executing a serial I/O transfer and serial I/O automatic transfer. 1-44 38C3 Group User's Manual HARDWARE DATA REQUIRED FOR MASK ORDERS AND ROM WRITING ORDERS/ROM PROGRAMMING METHOD DATA REQUIRED FOR MASK ORDERS The following are necessary when ordering a mask ROM production: 1. Mask ROM Order Confirmation Form 2. Mark Specification Form 3. Data to be written to ROM, in EPROM form (three identical copies) ROM PROGRAMMING METHOD The built-in PROM of the blank One Time PROM version and built-in EPROM version can be read or programmed with a general-purpose PROM programmer using a special programming adapter. Table 13 Programming adapter Package 80P6N-A 80D0 Name of Programming Adapter PCA4738F-80A PCA4738L-80A DATA REQUIRED FOR ROM WRITING ORDERS The following are necessary when ordering a ROM writing: 1. ROM Writing Confirmation Form 2. Mark Specification Form 3. Data to be written to ROM, in EPROM form (three identical copies) The PROM of the blank One Time PROM version is not tested or screened in the assembly process and following processes. To ensure proper operation after programming, the procedure shown in Figure 46 is recommended to verify programming. Programming with PROM programmer Screening (Caution) (150 C for 40 hours) Verification with PROM programmer Functional check in target device Caution : The screening temperature is far higher than the storage temperature. Never expose to 150 C exceeding 100 hours. Fig. 46 Programming and testing of One Time PROM version 38C3 Group User's Manual 1-45 HARDWARE FUNCTIONAL DESCRIPTION SUPPLEMENT FUNCTIONAL DESCRIPTION SUPPLEMENT Interrupt 38C3 group permits interrupts on the basis of 16 sources. It is vector interrupts with a fixed priority system. Accordingly, when two or more interrupt requests occur during the same sampling, the Table 14 Interrupt sources, vector addresses and interrupt priority Interrupt Source Priority Reset (Note 2) INT0 INT1 INT2 Serial I/O Timer A Timer 1 Timer 2 Timer 3 Timer 4 Timer 5 Timer 6 CNTR0 CNTR1 Key input (Keyon wake-up) A-D conversion BRK instruction 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Vector Addresses (Note 1) Low High FFFC16 FFFD16 FFFB16 FFF916 FFF716 FFF516 FFF316 FFF116 FFEF16 FFED16 FFEB16 FFE916 FFE716 FFE516 FFE316 FFE116 FFDF16 FFDD16 FFFA16 FFF816 FFF616 FFF416 FFF216 FFF016 FFEE16 FFEC16 FFEA16 FFE816 FFE616 FFE416 FFE216 FFE016 FFDE16 FFDC16 Interrupt Request Generating Conditions At reset At detection of either rising or falling edge of INT0 input At detection of either rising or falling edge of INT1 input At detection of either rising or falling edge of INT2 input At completion of serial I/O data transmit/receive At timer A underflow At timer 1 underflow At timer 2 underflow At timer 3 underflow At timer 4 underflow At timer 5 underflow At timer 6 underflow At detection of either rising or falling edge of CNTR0 input At detection of either rising or falling edge of CNTR1 input At falling of port P8 (at input) input logical level AND At completion of A-D conversion At BRK instruction execution External interrupt (active edge selectable) External interrupt (active edge selectable) External interrupt (falling valid) Valid when A-D conversion interrupt is selected Non-maskable software interrupt STP release timer underflow Remarks Non-maskable External interrupt (active edge selectable) External interrupt (active edge selectable) External interrupt (active edge selectable) Valid when serial I/O is selected higher-priority interrupt is accepted first. This priority is determined by hardware, but various priority processing can be performed by software, using an interrupt enable bit and an interrupt disable flag. For interrupt sources, vector addresses and interrupt priority, refer to Table 14. Notes 1: Vector addresses contain interrupt jump destination addresses. 2: Reset function in the same way as an interrupt with the highest priority. 1-46 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION SUPPLEMENT Timing After Interrupt The interrupt processing routine begins with the machine cycle following the completion of the instruction that is currently in execution. Figure 47 shows a timing chart after an interrupt occurs, and Figure 48 shows the time up to execution of the interrupt processing routine. SYNC RD WR Address bus Data bus PC Not used S, SPS S-1, SPS S-2, SPS BL AL BH AL, AH AH PCH PCL PS SYNC : CPU operation code fetch cycle (This is an internal signal which cannot be observed from the external unit.) BL, BH : Vector address of each interrupt AL, AH : Jump destination address of each interrupt SPS : "0016" or "0116" Fig. 47 Timing chart after interrupt occurs Interrupt request occurs Interrupt operation starts Main routine Waiting time for pipeline postprocessing Push onto stack vector fetch Interrupt processing routine 0 to 16 cycles 2 cycles 5 cycles 7 to 23 cycles (4 MHz, 1.75 s to 5.75 s) Fig. 48 Time up to execution of interrupt processing routine 38C3 Group User's Manual 1-47 HARDWARE FUNCTIONAL DESCRIPTION SUPPLEMENT A-D Converter A-D conversion is started by setting AD conversion completion bit to "0." During A-D conversion, internal operations are performed as follows. 1. After the start of A-D conversion, A-D conversion register goes to "0016." 2. The highest-order bit of A-D conversion register is set to "1," and the comparison voltage Vref is input to the comparator. Then, Vref is compared with analog input voltage VIN. 3. As a result of comparison, when Vref < VIN, the highest-order bit of A-D conversion register becomes "1." When Vref > VIN, the highest-order bit becomes "0." By repeating the above operations up to the lowest-order bit of the A-D conversion register, an analog value converts into a digital value. A-D conversion completes at 61 clock cycles (15.25 s at f(XIN) = 8 MHz) after it is started, and the result of the conversion is stored into the A-D conversion register. Concurrently with the completion of A-D conversion, A-D conversion interrupt request occurs, so that the AD conversion interrupt request bit is set to "1." Table 15 Relative formula for a reference voltage VREF of A-D converter and Vref When n = 0 When n = 1 to 1023 Vref = 0 Vref = VREF !n 1024 n: Value of A-D converter (decimal numeral) Table 16 Change of A-D conversion register during A-D conversion Change of A-D conversion register At start of conversion First comparison Second comparison Third comparison Value of comparison voltage (Vref) 0 1 V1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 VREF 2 VREF 2 VREF 2 0 VREF 4 VREF 4 VREF 8 V1 V2 After completion of tenth comparison ~ ~ A result of A-D conversion V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 ~ ~ VREF 2 VREF 4 **** VREF 1024 V1-V10: A result of the first comparison to the tenth comparison 1-48 38C3 Group User's Manual HARDWARE FUNCTIONAL DESCRIPTION SUPPLEMENT Figures 49 shows the A-D conversion equivalent circuit, and Figure 50 shows the A-D conversion timing chart. VCC About 2 k AN0 AN1 AN2 AN3 AN4 AN5 AN6 AN7 VSS VIN Sampling clock VCC VSS C Chopper amplifier A-D conversion register (high-order) A-D conversion register (low-order) b2 b1 b0 A-D control register AD conversion interrupt request VREF Built-in D-A converter Vref Reference clock AVSS Fig. 49 A-D conversion equivalent circuit Write signal for A-D control register 61 cycles AD conversion completion bit Sampling clock Fig. 50 A-D conversion timing chart 38C3 Group User's Manual 1-49 HARDWARE FUNCTIONAL DESCRIPTION SUPPLEMENT MEMORANDUM 1-50 38C3 Group User's Manual CHAPTER 2 APPLICATION 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 I/O port Timer Serial I/O LCD controller A-D converter ROM correct function Reset circuit Clock generating circuit APPLICATION 2.1 I/O port 2.1 I/O port This paragraph describes the setting method of I/O port relevant registers, notes etc. 2.1.1 Memory map Address 000016 000116 000216 000316 000416 000516 000616 000716 000816 000916 000A16 000B16 000C16 000D16 000E16 000F16 001016 001116 Port P4 (P4) Port P4 direction register (P4D) Port P5 (P5) Port P5 direction register (P5D) Port P6 (P6) Port P6 direction register (P6D) Port P7 (P7) Port P7 direction register (P7D) Port P8 (P8) Port P8 direction register (P8D) Port P0 (P0) Port P0 direction register (P0D) Port P1 (P1) Port P1 direction register (P1D) Port P2 (P2) Port P2 direction register (P2D) Port P3 (P3) 001616 001716 001816 PULL register A (PULLA) PULL register B (PULLB) Port P8 output selection register (P8SEL) Fig. 2.1.1 Memory map of I/O port relevant registers 2-2 38C3 Group User's Manual APPLICATION 2.1 I/O port 2.1.2 Relevant registers Port Pi b7 b6 b5 b4 b3 b2 b1 b0 Port Pi (i = 0, 1, 2, 3, 4, 5, 6, 8) (Pi: addresses 0016, 0216, 0416, 0616, 0816, 0A16, 0C16, 1016) b 0 1 2 3 4 5 6 7 Name Port Pi0 Port Pi1 Port Pi2 Port Pi3 Port Pi4 Port Pi5 Port Pi6 Port Pi7 Functions qIn output mode Write ******** Port latch Read ******** Port latch qIn input mode Write ******** Port latch Read ******** Value of pin At reset R W 0 0 0 0 0 0 0 0 Fig. 2.1.2 Structure of port Pi (i = 0, 1, 2, 3, 4, 5, 6, 8) Port P7 b7 b6 b5 b4 b3 b2 b1 b0 Port P7 (P7: address 0E16) b Name Functions qIn output mode Write ******** Port latch Read ******** Port latch qIn input mode Write ******** Port latch Read ******** Value of pin At reset R W 0 0 Port P70 1 Port P71 0 2 Nothing is arranged for these bits. When these 3 bits are read out, the contents are undefined. 4 5 6 7 0 0 0 0 0 0 ! ! ! ! ! ! ! ! ! ! ! ! Fig. 2.1.3 Structure of port P7 38C3 Group User's Manual 2-3 APPLICATION 2.1 I/O port Port P0 direction register, Port P1 direction register b7 b6 b5 b4 b3 b2 b1 b0 Port P0 direction register (P0D: address 0116) Port P1 direction register (P1D: address 0316) b Name Functions 0 : All bits of ports P0/P1 input mode 1 : All bits of ports P0/P1 output mode 0 Ports P0/P1 direction register At reset R W 0 ! 1 Nothing is arranged for these bits. When these 2 bits are read out, the contents are undefined. 3 4 5 6 7 0 0 0 0 0 0 0 ! ! ! ! ! ! ! ! ! ! ! ! ! ! Note: Ports P0 and P1 are switched to input and output by each port. When b0 of corresponding port direction register is set to "0", all 8 bits of port become input port. When b0 of corresponding port direction register is set to "1", all 8 bits of port become output port. Nothing is arranged for b1 to b7 of port P0 and port P1 direction registers. These are write disabled bits. Fig. 2.1.4 Structure of Port P0 direction register and port P1 direction register Port Pi direction register b7 b6 b5 b4 b3 b2 b1 b0 Port Pi direction register (i = 2, 4, 5, 6, 8) (PiD: addresses 0516, 0916, 0B16, 0D16, 1116) b Name Functions 0 : Port Pi0 input mode 1 : Port Pi0 output mode 0 : Port Pi1 input mode 1 : Port Pi1 output mode (Note) 0 : Port Pi2 input mode 1 : Port Pi2 output mode 0 : Port Pi3 input mode 1 : Port Pi3 output mode 0 : Port Pi4 input mode 1 : Port Pi4 output mode 0 : Port Pi5 input mode 1 : Port Pi5 output mode 0 : Port Pi6 input mode 1 : Port Pi6 output mode 0 : Port Pi7 input mode 1 : Port Pi7 output mode At reset R W 0 0 0 Port Pi direction register 1 2 3 4 5 6 7 0 0 0 0 0 0 Note: Bit 1 of the port P5 direction register (address 0B16) does not have direction register function, because P51 is an input port. When writing to bit 1 of the port P5 direction register, write "0" to the bit. Fig. 2.1.5 Structure of Port Pi direction register (i = 2, 4, 5, 6, 8) 2-4 38C3 Group User's Manual APPLICATION 2.1 I/O port Port P7 direction register b7 b6 b5 b4 b3 b2 b1 b0 Port P7 direction register (P7D: address 0F16) b Name Functions 0 : Port P70 input mode 1 : Port P70 output mode 0 : Port P71 input mode 1 : Port P71 output mode 2 Nothing is arranged for these bits. When these 3 bits are read out, the contents are undefined. 4 5 6 7 0 Port P7 direction register 1 At reset R W 0 ! 0 0 0 0 0 0 0 ! ! ! ! ! ! ! ! ! ! ! ! ! Fig. 2.1.6 Structure of Port P7 direction register PULL register A b7 b6 b5 b4 b3 b2 b1 b0 PULL register A (PULLA: address 1616) b 0 1 2 3 Name Functions At reset R W 1 1 1 1 Port P00-P07 0: No pull-down control 1: Pull-down control pull-down control 0: No pull-down control Port P10-P17 1: Pull-down control pull-down control 0: No pull-down control Port P20-P27 1: Pull-down control pull-down control Nothing is arranged for this bit. This is a write disabled bit. When this bit is read out, the contents are "1". 0: No pull-up control 4 Port P70, P71 1: Pull-up control pull-up control 5 Port P80-P87 0: No pull-up control 1: Pull-up control pull-up control 6 Nothing is arranged for this bit. This is a write disabled bit. When this bit is read out, the contents are "0". 7 Nothing is arranged for this bit. This is a write disabled bit. When this bit is read out, the contents are "0". 0 0 0 0 Note: The pin which is set to output port is cut off from pull-up control. Fig. 2.1.7 Structure of PULL register A 38C3 Group User's Manual 2-5 APPLICATION 2.1 I/O port PULL register B b7 b6 b5 b4 b3 b2 b1 b0 PULL register B (PULLB: address 1716) b Name Functions At reset R W 0 0 0 0 0 0 0 0: No pull-up control 0 Port P40-P43 1: Pull-up control pull-up control 0: No pull-up control 1 Port P44-P47 1: Pull-up control pull-up control 0: No pull-up control 2 Port P50, P52, P53 1: Pull-up control pull-up control 3 Port P54-P57 0: No pull-up control 1: Pull-up control pull-up control 0: No pull-up control 4 Port P60-P63 1: Pull-up control pull-up control 5 Port P64-P67 0: No pull-up control 1: Pull-up control pull-up control 6 Nothing is arranged for this bit. This is a write disabled bit. When this bit is read out, the contents are "0". 7 Nothing is arranged for this bit. This is a write disabled bit. When this bit is read out, the contents are "0". 0 Note: The pin which is set to output port is cut off from pull-up control. Fig. 2.1.8 Structure of PULL register B Port P8 output selection register b7 b6 b5 b4 b3 b2 b1 b0 Port P8 output selection register (P8SEL: address 1816) b Name Functions 0: CMOS output (in output mode) 1: N-channel open-drain output (in output mode) 0: CMOS output (in output mode) 1: N-channel open-drain output (in output mode) 0: CMOS output (in output mode) 1: N-channel open-drain output (in output mode) 0: CMOS output (in output mode) 1: N-channel open-drain output (in output mode) 0: CMOS output (in output mode) 1: N-channel open-drain output (in output mode) 0: CMOS output (in output mode) 1: N-channel open-drain output (in output mode) 0: CMOS output (in output mode) 1: N-channel open-drain output (in output mode) 0: CMOS output (in output mode) 1: N-channel open-drain output (in output mode) At reset R W 0 0 Port P8 output selection register 1 0 2 0 3 0 4 0 5 0 6 0 7 0 Fig. 2.1.9 Structure of Port P8 output selection register 2-6 38C3 Group User's Manual APPLICATION 2.1 I/O port 2.1.3 Terminate unused pins Table 2.1.1 Termination of unused pins Pins P3 Open at "H" output state. Termination P0, P1, P2, P4, * Set to the input mode and connect each to VCC or VSS through a resistor of 1 k to P50, P52-P57, P6, 10 k. P7, P8 * Set to the output mode and open at "L" or "H" output state. P51 Connect to VCC or VSS through a resistor of 1 k to 10 k. VL1-VL3 COM0-COM3 VREF XOUT AVSS Connect to Vss (GND). Open Open Open (only when using external clock) Connect to VSS (GND). 38C3 Group User's Manual 2-7 APPLICATION 2.1 I/O port 2.1.4 Notes on I/O port (1) Notes in standby state In standby state]1 for low-power dissipation, do not make input levels of an input port and an I/O port "undefined". Pull-up (connect the port to VCC) or pull-down (connect the port to VSS) these ports through a resistor. When determining a resistance value, note the following points: * External circuit * Variation of output levels during the ordinary operation When using built-in pull-up resistor, note on varied current values: * When setting as an input port : Fix its input level * When setting as an output port : Prevent current from flowing out to external l Reason The potential which is input to the input buffer in a microcomputer is unstable in the state that input levels of a input port and an I/O port are "undefined". This may cause power source current. ]1 standby state: stop mode by executing STP instruction wait mode by executing WIT instruction (2) Modifying port latch of I/O port with bit managing instruction When the port latch of an I/O port is modified with the bit managing instruction ]2, the value of the unspecified bit may be changed. l Reason The bit managing instructions are read-modify-write form instructions for reading and writing data by a byte unit. Accordingly, when these instructions are executed on a bit of the port latch of an I/O port, the following is executed to all bits of the port latch. *As for bit which is set for input port: The pin state is read in the CPU, and is written to this bit after bit managing. *As for bit which is set for output port: The bit value is read in the CPU, and is written to this bit after bit managing. Note the following: *Even when a port which is set as an output port is changed for an input port, its port latch holds the output data. *As for a bit of which is set for an input port, its value may be changed even when not specified with a bit managing instruction in case where the pin state differs from its port latch contents. ]2 Bit managing instructions: SEB and CLB instructions (3) Pull-up/Pull-down control When each port which has built-in pull-up/pull-down resistor (P0, P1, P2, P4, P50, P52-P57, P6, P7, P8) is set to output port, pull-up/pull-down control of corresponding port become invalid. (Pull-up/Pulldown cannot be set.) l Reason Pull-up control is valid only when each direction register is set to the input mode. 2-8 38C3 Group User's Manual APPLICATION 2.1 I/O port 2.1.5 Termination of unused pins (1) Terminate unused pins Output ports : Open Input ports : Connect each pin to VCC or VSS through each resistor of 1 k to 10 k. As for pins whose potential affects to operation modes such as pin INT or others, select the VCC pin or the VSS pin according to their operation mode. I/O ports : * Set the I/O ports for the input mode and connect them to VCC or VSS through each resistor of 1 k to 10 k. Ports that permit the selecting of a built-in pull-up resistor can also use this resistor. Set the I/O ports for the output mode and open them at "L" or "H". * When opening them in the output mode, the input mode of the initial status remains until the mode of the ports is switched over to the output mode by the program after reset. Thus, the potential at these pins is undefined and the power source current may increase in the input mode. With regard to an effects on the system, thoroughly perform system evaluation on the user side. * Since the direction register setup may be changed because of a program runaway or noise, set direction registers by program periodically to increase the reliability of program. (2) Termination remarks Input ports and I/O ports : Do not open in the input mode. q Reason * The power source current may increase depending on the first-stage circuit. * An effect due to noise may be easily produced as compared with proper termination and shown on the above. I/O ports : When setting for the input mode, do not connect to VCC or VSS directly. q Reason If the direction register setup changes for the output mode because of a program runaway or noise, a short circuit may occur between a port and VCC (or VSS). I/O ports : When setting for the input mode, do not connect multiple ports in a lump to VCC or VSS through a resistor. q Reason If the direction register setup changes for the output mode because of a program runaway or noise, a short circuit may occur between ports. * At the termination of unused pins, perform wiring at the shortest possible distance (20 mm or less) from microcomputer pins. 38C3 Group User's Manual 2-9 APPLICATION 2.2 Timer 2.2 Timer This paragraph explains the registers setting method and the notes relevant to the timers. 2.2.1 Memory map 002016 002116 002216 002316 002416 002516 002716 002816 002916 002A16 002C16 002D16 002E16 002F16 003016 003116 003C16 003D16 003E16 003F16 Timer 1 (T1) Timer 2 (T2) Timer 3 (T3) Timer 4 (T4) Timer 5 (T5) Timer 6 (T6) Timer 6 PWM register (T6PWM) Timer 12 mode register (T12M) Timer 34 mode register (T34M) Timer 56 mode register (T56M) Timer A register (low-order) (TAL) Timer A register (high-order) (TAH) Compare register (low-order) (CONAL) Compare register (high-order) (CONAH) Timer A mode register (TAM) Timer A control register (TACON) Interrupt request register 1 (IREQ1) Interrupt request register 2 (IREQ2) Interrupt control register 1 (ICON1) Interrupt control register 2 (ICON2) Fig. 2.2.1 Memory map of registers relevant to timers 2-10 38C3 Group User's Manual APPLICATION 2.2 Timer 2.2.2 Relevant registers (1) 8-bit timer Timer i b7 b6 b5 b4 b3 b2 b1 b0 Timer i (i = 1, 3, 4, 5, 6) (Ti: addresses 2016, 2216, 2316, 2416, 2516) b Functions At reset R W 1 1 1 1 1 1 1 1 0 * Set timer i count value. 1 * The value set in this register is written to both 2 the timer i and the timer i latch at one time. 3 * When the timer i is read out, the count value 4 of the timer i is read out. 5 6 7 Fig. 2.2.2 Structure of Timer i (i=1, 3, 4, 5, 6) Timer 2 b7 b6 b5 b4 b3 b2 b1 b0 Timer 2 (T2: address 2116) b Functions At reset R W 1 0 0 0 0 0 0 0 0 * Set timer 2 count value. 1 * The value set in this register is written to both 2 the timer 2 and the timer 2 latch at one time. 3 * When the timer 2 is read out, the count value 4 of the timer 2 is read out. 5 6 7 Fig. 2.2.3 Structure of Timer 2 38C3 Group User's Manual 2-11 APPLICATION 2.2 Timer Timer 6 PWM register b7 b6 b5 b4 b3 b2 b1 b0 Timer 6 PWM register (T6PWM: address 2716) b 0 1 2 3 4 5 6 7 Functions * In timer 6 PWM1 mode "L" level width of PWM rectangular waveform is set. * Duty of PWM rectangular waveform: n/(n + m) Period: (n + m) x ts n = timer 6 set value m = timer 6 PWM register set value ts = timer 6 count source period At n = 0, all PWM output "L". At m = 0, all PWM output "H". (However, n = 0 has priority.) * Selection of timer 6 PWM1 mode Set "1" to the timer 6 operation mode selection bit. At reset R W Undefined Undefined Undefined Undefined Undefined Undefined Undefined Undefined Fig. 2.2.4 Structure of Timer 6 PWM register Timer 12 mode register b7 b6 b5 b4 b3 b2 b1 b0 Timer 12 mode register (T12M: address 2816) b 0 1 2 3 Name Timer 1 count stop bit Timer 2 count stop bit Timer 1 count source selection bits Functions 0: Count operation 1: Count stop 0: Count operation 1: Count stop b3 b2 At reset R W 0 0 0 0 0 0 0 0 0 0: f(XIN)/16 or f(XCIN)/16 0 1: f(XCIN) 1 0: f(XIN)/32 or f(XCIN)/32 1 1: f(XIN)/128 or f(XCIN)/128 4 Timer 2 count source selection bits 5 b5 b4 0 0: Timer 1 underflow 0 1: f(XCIN) 1 0: External count input CNTR0 1 1: Not available 0: I/O port 6 Timer 1 output selection bit (P41) 1: Timer 1 output 7 Nothing is arranged for this bit. This is a write disabled bit. When this bit is read out, the contents are "0". Fig. 2.2.5 Structure of Timer 12 mode register 2-12 38C3 Group User's Manual APPLICATION 2.2 Timer Timer 34 mode register b7 b6 b5 b4 b3 b2 b1 b0 Timer 34 mode register (T34M: address 2916) b 0 1 2 3 Name Timer 3 count stop bit Timer 4 count stop bit Timer 3 count source selection bits Functions 0: Count operation 1: Count stop 0: Count operation 1: Count stop b3 b2 At reset R W 0 0 0 0 0: f(XIN)/16 or f(XCIN)/16 0 1: Timer 2 underflow 1 0: f(XIN)/32 or f(XCIN)/32 1 1: f(XIN)/128 or f(XCIN)/128 4 Timer 4 count source selection bits 5 b5 b4 0 0: f(XIN)/16 or f(XCIN)/16 0 1: Timer 3 underflow 1 0: External count input CNTR1 1 1: Not available 0: I/O port 6 Timer 3 output selection bit (P42) 1: Timer 3 output 7 Nothing is arranged for this bit. This is a write disabled bit. When this bit is read out, the contents are "0". 0 0 0 0 Fig. 2.2.6 Structure of Timer 34 mode register Timer 56 mode register b7 b6 b5 b4 b3 b2 b1 b0 Timer 56 mode register (T56M: address 2A16) b 0 1 2 3 4 5 Name Timer 5 count stop bit Timer 6 count stop bit Timer 5 count source selection bit Timer 6 operation mode selection bit Timer 6 count source selection bits Functions 0: Count operation 1: Count stop 0: Count operation 1: Count stop 0: f(XIN)/16 or f(XCIN)/16 1: Timer 4 underflow 0: Timer mode 1: PWM mode b5 b4 At reset R W 0 0 0 0 0 0 0 6 Timer 6 (PWM) output selection bit (P52) 7 Nothing is arranged for this bit. This is a write disabled bit. When this bit is read out, the contents are "0". 0 0: f(XIN)/16 or f(XCIN)/16 0 1: Timer 5 underflow 1 0: Timer 4 underflow 1 1: Not available 0: I/O port 1: Timer 6 output 0 Fig. 2.2.7 Structure of Timer 56 mode register 38C3 Group User's Manual 2-13 APPLICATION 2.2 Timer (2) 16-bit timer Timer A register (low-order, high-order) b7 b6 b5 b4 b3 b2 b1 b0 Timer A register (low-order, high-order) (TAL, TAH: addresses 2C16, 2D16) b Functions At reset R W 1 1 1 1 1 1 1 1 0 * Set timer A count value. 1 * When the timer A write control bit of the timer A mode register is "0", the value is written to 2 timer A and the latch at one time. 3 When the timer A write control bit of the timer A mode register is "1", the value is written only 4 to the latch. 5 * The timer A count value is read out by reading 6 this register. 7 Notes 1: When reading and writing, perform them to both the highorder and low-order bytes. 2: Read both registers in order of TAH and TAL following. 3: Write both registers in order of TAL and TAH following. 4: Do not read both registers during a write, and do not write to both registers during a read. Fig. 2.2.8 Structure of Timer A register (low-order, high-order) Compare register (low-order, high-order) b7 b6 b5 b4 b3 b2 b1 b0 Compare register (low-order, high-order) (CONAL, CONAH: addresses 2E16, 2F16) b 1 2 3 4 5 6 7 Functions At reset R W 0 0 0 0 0 0 0 0 0 * Set compare register value. Note: Write registers in order of CONAH, CONAL, TAL, and TAH following. Fig. 2.2.9 Structure of Compare register (low-order, high-order) 2-14 38C3 Group User's Manual APPLICATION 2.2 Timer Timer A mode register b7 b6 b5 b4 b3 b2 b1 b0 Timer A mode register (TAM: address 3016) b Name b1b0 Functions 0 0: Timer mode 0 1: Pulse output mode 1 0: IGBT output mode 1 1: PWM mode At reset R W 0 0 0 0 Timer A operating mode bits 1 2 Timer A write control bit 0: Write data to both timer latch and timer 1: Write data to timer latch b4b3 3 Timer A count source selection bits 4 5 Timer A output active edge switch bit 0 0: f(XIN) 0 1: f(XIN)/2 1 0: f(XIN)/4 1 1: f(XIN)/8 0: Output starts with "L" level 1: Output starts with "H" level 1: Count stop 0 0 0 0 0 6 Timer A count stop bit 0: Count operating 7 Timer A output selection bit (P50) 0: I/O port 1: Timer A output Fig. 2.2.10 Structure of Timer A mode register Timer A control register b7 b6 b5 b4 b3 b2 b1 b0 Timer A control register (TACON: address 3116) b Name clock selection bit Functions 0: f(XIN)/2 1: f(XIN)/4 b2b1 At reset R W 0 0 0 0 0 0 0 0 0 Noise filter sampling 1 External trigger delay time selection bits 2 0 0: No delay 0 1: (4/f(XIN))s 1 0: (8/f(XIN))s 1 1: (16/f(XIN))s 1: INT1 interrupt used 1: INT2 interrupt used 3 Timer A output control 0: Not used bit 1 (P56) bit 2 (P57) 4 Timer A output control 0: Not used 5 Nothing is arranged for these bits. These are write 6 disabled bits. When these bits are read out, the 7 contents are "0". Fig. 2.2.11 Structure of Timer A control register 38C3 Group User's Manual 2-15 APPLICATION 2.2 Timer (3) 8-bit timer, 16-bit timer Interrupt request register 1 b7 b6 b5 b4 b3 b2 b1 b0 Interrupt request register 1 (IREQ1 : address 3C16) b Name Functions 0 : No interrupt request issued 1 : Interrupt request issued 0 : No interrupt request issued 1 : Interrupt request issued 0 : No interrupt request issued 1 : Interrupt request issued 0 : No interrupt request issued 1 : Interrupt request issued 0 : No interrupt request issued 1 : Interrupt request issued 0 : No interrupt request issued 1 : Interrupt request issued 0 : No interrupt request issued 1 : Interrupt request issued 0 : No interrupt request issued 1 : Interrupt request issued At reset R W 0 V 0 INT0 interrupt request bit 1 INT1 interrupt request bit 2 INT2 interrupt request bit 3 Serial I/O interrupt request bit 4 Timer A interrupt request bit 5 Timer 1 interrupt request bit 6 Timer 2 interrupt request bit 7 Timer 3 interrupt request bit 0 V 0 V 0 V 0 V 0 V 0 V 0 V V: "0" can be set by software, but "1" cannot be set. Fig. 2.2.12 Structure of Interrupt request register 1 2-16 38C3 Group User's Manual APPLICATION 2.2 Timer Interrupt request register 2 b7 b6 b5 b4 b3 b2 b1 b0 Interrupt request register 2 (IREQ2 : address 3D16) b Name Functions At reset R W 0 0 0 0 0 0 0 0 V V V V V V V 0 : No interrupt request issued 0 Timer 4 interrupt 1 : Interrupt request issued request bit 0 : No interrupt request issued 1 Timer 5 interrupt 1 : Interrupt request issued request bit Timer 6 interrupt 0 : No interrupt request issued 2 1 : Interrupt request issued request bit 0 : No interrupt request issued 3 CNTR0 interrupt 1 : Interrupt request issued request bit 0 : No interrupt request issued 4 CNTR1 interrupt 1 : Interrupt request issued request bit Key input interrupt 0 : No interrupt request issued 5 1 : Interrupt request issued request bit 0 : No interrupt request issued 6 AD conversion interrupt request bit 1 : Interrupt request issued 7 Nothing is arranged for this bit. This is a write disabled bit. When this bit is read out, the contents are "0". V: "0" can be set by software, but "1" cannot be set. Fig. 2.2.13 Structure of Interrupt request register 2 38C3 Group User's Manual 2-17 APPLICATION 2.2 Timer Interrupt control register 1 b7 b6 b5 b4 b3 b2 b1 b0 Interrupt control register 1 (ICON1 : address 3E16) b Name Functions 0 : Interrupt disabled 1 : Interrupt enabled 0 : Interrupt disabled 1 : Interrupt enabled 0 : Interrupt disabled 1 : Interrupt enabled 0 : Interrupt disabled 1 : Interrupt enabled 0 : Interrupt disabled 1 : Interrupt enabled 0 : Interrupt disabled 1 : Interrupt enabled 0 : Interrupt disabled 1 : Interrupt enabled 0 : Interrupt disabled 1 : Interrupt enabled At reset R W 0 0 0 0 0 0 0 0 0 INT0 interrupt enable bit 1 INT1 interrupt enable bit 2 INT2 interrupt enable bit 3 Serial I/O interrupt enable bit 4 Timer A interrupt enable bit 5 Timer 1 interrupt enable bit 6 Timer 2 interrupt enable bit 7 Timer 3 interrupt enable bit Fig. 2.2.14 Structure of Interrupt control register 1 Interrupt control register 2 b7 b6 b5 b4 b3 b2 b1 b0 Interrupt control register 2 (ICON2 : address 3F16) b Name Functions At reset R W 0 0 0 0 0 0 0 0 0 Timer 4 interrupt 0 : Interrupt disabled enable bit 1 : Interrupt enabled 1 Timer 5 interrupt 0 : interrupt disabled enable bit 1 : Interrupt enabled 2 Timer 6 interrupt 0 : interrupt disabled enable bit 1 : Interrupt enabled 3 CNTR0 interrupt 0 : interrupt disabled enable bit 1 : Interrupt enabled 0 : interrupt disabled 4 CNTR1 interrupt 1 : Interrupt enabled enable bit 5 Key input interrupt 0 : interrupt disabled 1 : Interrupt enabled enable bit 6 AD conversion 0 : interrupt disabled interrupt enable bit 1 : Interrupt enabled 7 Nothing is arranged for this bit. This is a write disabled bit. When this bit is read out, the contents are "0". Fig. 2.2.15 Structure of Interrupt control register 2 2-18 38C3 Group User's Manual APPLICATION 2.2 Timer 2.2.3 Timer application examples (1) Basic functions and uses [Function 1] Control of event interval (Timer 1 to Timer 6, Timer A: timer mode) When a certain time, by setting a count value to each timer, has passed, the timer interrupt request occurs. |